Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

change Buy Now to Add To Cart on products_listing.php


freakystreak

Recommended Posts

I was wondering if it is possible to change the 'Buy Now' button on the products_listing page in OSC Frozen so that it now uses add_to_cart. I would like to use jquery/ajax for updating the cart as I want to display the number of products added. Has anyone any knowledge of a possible solution or contribution to do this? Seen some jquery/ajax apps but they don't do what I want. 

Ah, the world wide web. What a wonderful place.

Link to comment
Share on other sites

The industry standard nomenclature is "Buy Now" means "check out immediately with this one item in the cart", while "Add to Cart" (or just "Buy") means "throw this in the shopping cart now, for later checkout". "Add to Cart" should be the default action for osC, but "Buy Now" might be available as an alternative (or an additional button to "Add to Cart"). Updating the item count in the cart ought to be fairly simple, especially if you are going to leave the product page anyway (and end up repainting the page). To update the count without leaving the page would require jQuery or AJAX, which I can't really help you with.

Link to comment
Share on other sites

You don't need to change "buy_now" to "add_to_cart" to get ajax functionality.  I took special care to code both these things so that what you (I think) want can be done without such changes.

However, it might be wise to state exactly what you do want.  

Link to comment
Share on other sites

Thanks for the replies. What I'm trying to achieve is basically allow the customer to add multiple items into their cart from the products_listing page by adding to cart and not by using the default  buy_now button for each product. I want to use ajax/jquery so that there is no page reload and that the quantities that the customers chooses is displayed and not reset. I will be adding a quantity box to the products_listing page.

One solution I thought of was to change the default buy_now action to the add_to_cart action, hence my original question.

Does this explain better as to what I want to happen? Again, thanks for the responses.

Ah, the world wide web. What a wonderful place.

Link to comment
Share on other sites

You'd need to change that script (includes/modules/product_listing.php) to a form along with one button at the bottom.  Depending on what version you use, you may also need to create an action for the form.  Do these two parts first and get it working to add multiple products/qty into cart.

After that is done and working, then think about adding in ajax functionality - which should be fairly straghtforward.

Link to comment
Share on other sites

2 hours ago, freakystreak said:

What I'm trying to achieve is basically allow the customer to add multiple items into their cart from the products_listing page by adding to cart and not by using the default  buy_now button for each product. I want to use ajax/jquery so that there is no page reload and that the quantities that the customers chooses is displayed and not reset. I will be adding a quantity box to the products_listing page.

This won't work as you want if your products have attributes because the customer will be redirected to the product page so that the attributes can be selected. So if you show 10 products on the page and the customer chooses add to cart for the first one, as soon as the add to cart button is clicked, they will be redirected, assuming that first one has attributes.

If you don't use attributes, then it will work. There are addons that do this so you should look there first. They may require updating but would be better than starting from scratch.

If you do use attributes and there are not too many, you could add selectors to the listing page so the attributes could be selected there. Or, maybe better, prevent the redirect and open a popup where the customer can select the attributes. That would require a fairly large amount of coding but it is possible.

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

Thanks guys, I am going to use products without attributes for this very reason. Good to know that there are some add ons that allow this, I fully understand that they might need to be updated as I'm using the latest v2.3.4.1 CE Frozen edition. Off to the apps page and a searching I go. 

Ah, the world wide web. What a wonderful place.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...