Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

display the quantity to buy in the product listings


mic

Recommended Posts

Hi,

 

I would like to display the quantity to buy and the add to cart button right on the product listing, to be able to place the order right from the product listings without having to click for the extended description.

In the FAQ's is a sample (http://www.oscommerce.com/community/faq,5-20/q,27), but the code doesn't work with the latest Snapshot. I tried to adjust the code, but for a newbie on PHP is it hard to succeed:-)

 

Is there somebody who has a tip for me?

 

Thank's for your support, mic

Link to comment
Share on other sites

You should just need to turn on the Buy Now button in the Admin.

 

NOTE: Products with attributes go from Product Listing to the Product Page so the customer can select their options.

Link to comment
Share on other sites

You should just need to turn on the Buy Now button in the Admin.

 

NOTE: Products with attributes go from Product Listing to the Product Page so the customer can select their options.

 

Yes, I know, but this was not my question. The most customers know the products, so the don't want to go to the Product Page. Since two years we have an other eShop where the customers used to have this feature and in the above Link you see that is possible on osC - but unfortunately not up to date. What a pity:-(

 

Greetings, mic

Link to comment
Share on other sites

Michael;

 

Take a look at this thread and the code offered by mouflon

http://www.oscommerce.com/forums/viewtopic.php...ouched&start=18

 

I have used this and it is working for me (example at: http://farmex.now.tc/catalog/index.php?man...facturers_id=18 ) although, because I do use the weight and quantity in other areas, I have replaced the "Buy Now" buttons with the quantity select boxes.

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Link to comment
Share on other sites

Michael;

 

Take a look at this thread and the code offered by mouflon

http://www.oscommerce.com/forums/viewtopic.php...ouched&start=18

 

I have used this and it is working for me (example at: http://farmex.now.tc/catalog/index.php?man...facturers_id=18 ) although, because I do use the weight and quantity in other areas, I have replaced the "Buy Now" buttons with the quantity select boxes.

 

Thanks mugitty for the tip,

 

but this code doesn't work for me.

I got the message: Parse error: parse error, unexpected T_STRING in .../catalog/includes/modules/product_listing.php on line 132

 

But on line 132 is only that what was before there: $lc_align = 'right';

 

Yes, so how it is on your site I'd like to have it too.

Link to comment
Share on other sites

Are you trying to get something like this effect?

 

http://www.thewebmakerscorner.com/snap_att....php?cPath=3_10

 

The quantity boxes let you add for all of them and submit once. The Buy Now button is there on products requiring Option Selections.

 

Yes, Linda, that's exact what I'm looking for. But whithout the buy_now_button, this confused the costumer in conjunction with quantity boxes. But when this feature is in this demo shop (so your link) implemented, why I haven't this? Or is this a really new snapshot, I have one of the 2003-01-10.

Link to comment
Share on other sites

You can change the Buy Now to other buttons like Options or something, but you cannot get a product into the cart when there are Options to be selected so you have to go to the products page.

 

This is a combination of the quantity units that was discussed on another thread and I then took it a few steps further.

 

Example: If the product is in the cart when that page displays it will show the already selected qty and say Add Additional ...

 

Do a search on addtocart and you should be able to find it.

Link to comment
Share on other sites

  • 1 year later...

This Contribution will add a quantity box above your "Add to Cart" button in the Product Listing (product_listing.php) page. This module works for Version MS2.2 and may have bugs but it works perfectly on my end. If you have any enhancements or changes please feel free to make them here at the Contribution site.

 

 

========================================

 

All you need to do is make the following simple changes:

 

1) in catalog/includes/modules/product_listing.php

 

 

find:

 

case 'PRODUCT_LIST_BUY_NOW':

$lc_align = 'center';

$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>';

break;

}

 

 

 

replace with:

 

case 'PRODUCT_LIST_BUY_NOW':

$lc_align = 'center';

$lc_text = '<form name="cart_quantity" method="post" action="' . tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product', 'NONSSL'). '"><input type="hidden" name="products_id" value="' . $listing['products_id'] . '"><input type="text" name="quantity" value="1" maxlength="5" size="5"><br>' . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</form>';

break;

}

 

 

 

 

2) in catalog/includes/application_top.php

 

find:

 

$HTTP_POST_VARS['id']))+1

 

 

replace with:

 

$HTTP_POST_VARS['id']))+$quantity

 

 

 

 

 

 

-----------------------------------

That's it. You're done!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...