Jump to content
florin.dediu

Butoane pentru cantitati

Recommended Posts

Salutare dragi colegi,

 

Am tot căutat pe forum, și nu numai, o modalitate de a crea, pe lângă butonul normal, alte două butoane de adăugare în coș.

Cu ce ar fi aceste butoane diferite? Cantitatea.

Pentru a înțelege mai bine nevoia mea, atașez mai jos ideea de bază.

butoane_manusi.jpg

Share this post


Link to post
Share on other sites

Eu vad urmatorii pasi de facut:

 

1. Creezi 2 reguli de pret la acest produs - una pentru 2 bucati si una pentru 3;

2. In pagina produsului (product.tpl) trebuie sa modifici partea de "quantity discounts" - ca in loc de afisare tabelara sa pui butoane + acel text cu procentul de reducere;

3. In codul de javascript, la apasarea oricarui buton de discount, apelezi ajaxCart.add cu cantitatea necesara.

Share this post


Link to post
Share on other sites

Până la urmă am reușit! 
Edit: nu am reușit cum trebuie ...  :wacko:
 
Pentru cei interesați atașez mai jos codul sursă din product.tpl 

<div id="quantity_wanted_p"{if (!$allow_oosp && $product->quantity <= 0) || !$product->available_for_order || $PS_CATALOG_MODE} style="display: none;"{/if}>
							<label class="qty-label">{l s='Quantity'}:</label>
							<div class="quantity-input-wrapper">
							<input type="text" name="qty" id="quantity_wanted" class="text" value="{if isset($quantityBackup)}{$quantityBackup|intval}{else}{if $product->minimal_quantity > 1}{$product->minimal_quantity}{else}1{/if}{/if}" />
							<a href="#" data-field-qty="qty" class="transition-300 product_quantity_down">
								<span><i class="icon-caret-down"></i></span>
							</a>
							<a href="#" data-field-qty="qty" class="transition-300 product_quantity_up ">
								<span><i class="icon-caret-up"></i></span>
							</a>
							</div> 
							
							<!-- Butoane reducere -->
							{if !$content_only}
								{if (isset($quantity_discounts) && count($quantity_discounts) > 0)}
								<br><br><button type="submit" name="qty" id="quantity_wanted2 add_to_cart2" class="exclusive2 buttons_bottom_block no-print" value="2">
									<span>Adauga 2 produse <br><b>si ai reducere 10%</b></span>
								</button>
								{/if} 
							{/if}
								<!-- end butoane --> 
								<span class="clearfix"></span>
						</div>
Edited by florin.dediu (see edit history)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More