Jump to content

Multiple Buy Buttons


Recommended Posts

Hey everyone

I have a question - I've done a few prestashops now for clients and I want to know if I can have multiple buy buttons for an item.

The scenario is this - the current shop that I'm doing is a health shop that sells supplements i.e. glucosamine - my client sells different volumes of each one, for example 30, 60 and 120 tab packs.

I want to be able to have a button for each quantity rather than have something like the color picker drop down - the customer will have the facility to click and add the volume they wish straight into the basket on the search results page rather than have to head futher into the site to the actual items page. The effect will be to cluster items by quantity of tabs in the pack rather tha have it render as all seperate items.

I'm hoping that there will be functionality already in there that I can use rather than have to write new code.

I reckon this would be a lot more usable.

Any help is greatly appreciated here!

Cheers

Blake

Link to comment
Share on other sites

This code modification will replace the attribute drop-down with a new button for each attribute item.
It will only apply itself if there is only 1 attribute group set.

These changes are made to /themes/prestashop/product.tpl around line #282

1) Add a div around the "add to cart" button, so we can hide it.


quantity == 0} style="display:none;"{/if} id="add_to_cart" class="buttons_bottom_block"><input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive" /></p>



2) Create the new buttons , they will be called "Add (item name) to cart"
In the code it's Add {$group_attribute|escape:'htmlall':'UTF-8'} to cart, you can change that if you need to.

You can add this code right below the one above, or anywhere else you would like the buttons to appear.

{if $groups|@count == 1}

   [removed]
   $("#attributes").css('display','none');
   $("#add_to_cart_hide").css('display','none');
   [removed]
   {foreach from=$groups key=id_attribute_group item=group}
       {assign var='groupName' value='group_'|cat:$id_attribute_group}
       {foreach from=$group.attributes key=id_attribute item=group_attribute}

<input></p>
       {/foreach}
   {/foreach}



{/if}



Cheers,

Tomer.

Link to comment
Share on other sites

Cheers for that Tomer - deffo along the right lines...

I'm not quite there yet though.... I have

{if $groups|@count == 1}

                   [removed]
                       $("#attributes").css('display','none');
                       $("#add_to_cart_hide").css('display','none');
                   [removed]
               {foreach from=$groups key=id_attribute_group item=group}
                   {assign var='groupName' value='group_'|cat:$id_attribute_group}
                   {foreach from=$group.attributes key=id_attribute item=group_attribute}

<input type="submit" value="{$group_attribute|escape:'htmlall':'UTF-8'}" class="exclusive" /></p>
                   {/foreach}
               {/foreach}



           {/if}



It has hidden the drop down box, and the original 'buy' button as required, but its not passing the right variable AND the nice jquery outline event isn't happening when something gets added into the basket........?

I'm no smarty expert, but the for loop executes for each item in the attribute group, then it makes three submit buttons, that all execute each the same form - can it add a value for each group attribute to the submit button, or do we need another way...?

I could also do with getting the price for each of the buttons too.

Any ideas as to this?

Then I have one final prob - can I include the individual button for each attribute on the homefeatured items on the home page so that a user can just click whatever they want as soon as they hit the home page?

Cheers for everything man, you're a life saver

Link to comment
Share on other sites

Sorry, I have just notice the the code didn't come out right, parts that I entered there did not show up after I submitted (javascript parts)

I will post it on my site, and add a link to it here in a few minutes.

As for the home featured part, it is possible, but this code won't work for you, you need to add the ability to change the attributes just like in the product page and that doesn't exist.

It would require more complex code changes that I don't have the time right now to do.

Link to comment
Share on other sites

Got this (nearly) sorted HUGE thanks to Tomer....

See link above

Works a dream!

Only thing that I want to do with it now is to add the price - if anyone can help me with that.......?

(my intent to get this on the homefeature items remains also - very urgent for hlep with this!)

Link to comment
Share on other sites

I think this is a pretty major problem with prestashop…….

There has been lots of attention for this on the products page, but it could affect conversions quite a lot if you add that extra bit of navigation making the user head to another page, read it, realise there are other options and then select them.

If you have the facility to promote your best products on the home page and have a buy button right there, surely it will be more usable and profitable.

What does everyone think?

Cheers

Blake

;o)

Link to comment
Share on other sites

  • 5 months later...

Did anyone ever get this completely sorted out?

For each product Ive got 2 attributes: Size & Subscription

Size: 4lbs, 8lbs, 16lbs, etc...
Supscription: None, Monthly


My site makes a recommended monthly supply so I want to have a "Buy It Now" button next to the recommendation. Based on what is their suggested amount, they will press the button and the quantity & attributes will be sent to the cart.

Any help would be appreciated.

Thx!

Link to comment
Share on other sites

I managed to achieve what I intended to set out - that was have multiple buy now buttons for different attribute values on the home page.

I dont think that would ever work with more than 1 set of attribute values though, but I'm sure you could get some kind of reduced down version of the product page on the home-featured module.

I had a little help from simonthetemp with mine, but you can have a look : www.selecthealthy.com

Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...

Tomer:

I've been looking a solution for a problem many of us are having. I'm trying to get something like "stteped attributes", or "chained attributes" so I can have a master attribute that, depending on the attribute selected there, changes it's sub-attributes options showed. I found no clue on how to solve that, the button "Display unavailable product attributes on product page" from the back office doesn't seem to make any change if a combination shows an unavailable combination except hidding the "add to cart button", but that's messy cause some items have many attributes not available and customers have to guess what they can buy. I saw somewhere a way to show a list of possyble combinations generated for each product, but then, once again, customers have to read a chart and somehow "dial" between menus. So, I came across your way of showing multiple "add to cart buttons" and got an idea... Wouldn't it be possible to add some attributes related to each "add to cart" button?

excuse me if it's a silly question, don't know much about coding, just started getting my fingers into php.

Regards,

Link to comment
Share on other sites

  • 2 months later...
  • 3 years later...

Hi, if you still need additional buy button, or you plan to migrate your site to newer PrestaShop (1.5 or 1.6) then you can ues Buy More to add additional Buy buttons to your product.

 

It is very easy to use, and you can find more info about it here:

http://addons.prestashop.com/en/front-office-features-prestashop-modules/16917-buy-more.html

 

and see its demo here (Buy T-Shirt button):

http://demo.prestamusicshop.com/music/8-sunsearcher-sunsearcher-spirit.html

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...