Jump to content

How to add "Add to cart" button in a block module?


Recommended Posts

Hello all,

I am trying to add an "add to cart" button in this module specifically - http://www.prestashop.com/forums/viewthread/5801/P75/third_party_modules/solved_countdown_timer_for_special_prices_current_v0_dot_8_dot_1

I have tried copying pasting the "add to cart" codes from various *tpl's - product, product-list, homefeatured.tpl, etc....but none of them worked :(

I was curious if there's a way to apply an "add to cart" button to the countdown timer module? I would only run one item in the special countdown module at a time (aka. only have one product on sale at all time) ...

Please help! And thank you all!

Link to comment
Share on other sites

  • 5 weeks later...

Hello Curt, very sorry for the late reply!

I have contacted a developer and figured out a method - basically just add the following into anywhere you want the "add to cart" button to show up:

<form id="buy_block12" action="{$base_dir}cart.php" method="post">

           <!-- hidden datas -->


               <input type="hidden" name="token" value="{$static_token}" />
               <input type="hidden" id="product_page_product_id" value="1" name="id_product">
               <input type="hidden" value="1" name="add">
               <input type="hidden" name="id_product_attribute" id="idCombination" value="" />




{l s='Quantity:'}
               <input type="text" name="qty" id="quantity_wanted" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}1{/if}" size="2" maxlength="3" />



<input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive" /></p>
                   </form>



It doesn't have the animation function that shows the product being added into the blockcart - instead it takes you straight to the order.php page - which is actually what I wanted for my site. I am not sure how to make the animation of the typical "add cart" function work like it would when you "add to cart" in a product page...if anybody else know how please feel free to contribute though!

Link to comment
Share on other sites

  • 3 months later...

Who has the solution for this?

I need to have an add to cart button in block new products.

Iv added taken these lines from the products page and pasted them in the module tpl..

{if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && !$PS_CATALOG_MODE}
                   {if ($product.allow_oosp || $product.quantity > 0) && $product.customizable != 2}
getPageLink('cart.php')}?add&id_product={$product.id_product|intval}{if isset($static_token)}&token={$static_token}{/if}" title="{l s='Add to cart'}">{l s='Add to cart'}
                   {else}
{l s='Add to cart'}
                   {/if}
               {/if}



The problem is that,this does not work the proper way.
The block cart gets updated but only when i reload the page..
The js effect is not triggered as well..
Im sure that im missing something here..

Help plz :)

Link to comment
Share on other sites

  • 2 weeks later...
Who has the solution for this?

I need to have an add to cart button in block new products.

Iv added taken these lines from the products page and pasted them in the module tpl..

{if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && !$PS_CATALOG_MODE}
                   {if ($product.allow_oosp || $product.quantity > 0) && $product.customizable != 2}
getPageLink('cart.php')}?add&id_product={$product.id_product|intval}{if isset($static_token)}&token={$static_token}{/if}" title="{l s='Add to cart'}">{l s='Add to cart'}
                   {else}
{l s='Add to cart'}
                   {/if}
               {/if}




The problem is that,this does not work the proper way.
The block cart gets updated but only when i reload the page..
The js effect is not triggered as well..
Im sure that im missing something here..

Help plz :)



try this
class="button ajax_add_to_cart_button product_img_link exclusive"
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...