limit the number of articles in the basket ?

bettywau

Avatar: bettywau

2010-11-09 10:28

Hello,

I use version 3.3.
I would wish to be able to limit the quantity of article in the basket to limit the number has 5 article maximum. either 5 by articles, or 5 on the whole in the basket.
How I can make? thank you

» Quick.Cart v3.x

bettywau

boboo

Avatar: boboo

2010-11-09 19:08

1. Please describe it more exactly (what when i buy 3 pieces of article "A" and 4 pieces of "B"?);
2. What is your native language (if RU, DE, PL, then write in this language)?

http://skupienie.kimla.de/?software-quickcart,106

bettywau

Avatar: bettywau

2010-11-10 09:55

Hello, i am french so please excuse me .. My english est not very good.
I encounter a problem on the level of a Select product number inserted in my "orders_basket.tpl" page in order to limit the number of articles to be added in the basket of purchase.
I sought hours but in vain…

I thus integrated a drop-down list has single choice instead of the numerical zone of seizure.
the list appears without problem in the basket of purchase but when I modify it and that I click on the button “ recount” the entire amount calculation indeed but the number of articles in the basket goes back by default to 1, which is impacted in the confirmation of order in the following page and the email sent to the customer and to the salesman.
How can I preserve the value of the drop-down list to select at the time of the sending of the form or the click on the button of update?

code of ""orders_basket.tpl"" modified :

<!-- BEGIN BASKET_LIST -->
<
tr class="l$aData[sStyle]">
<
th>
<
a href="$aData[sLinkName]">$aData[sName]</a>
</
th>
<
td class="price">
$aData[sPrice]
</
td>
<
td class="quantity">
<
label for="quantity$aData[iProduct]">$lang[Quantity]</label><select name="aProducts[$aData[iProduct]]" value="$aData[iQuantity]]" maxlength="1" id="quantity$aData[iProduct]" alt="int" />
<
option value="1">1</option>
<
option value="2">2</option>
<
option value="3">3</option>
<
option value="4">4</option>
<
option value="5">5</option>
</
select>
</
td>
<
td class="summary">
$aData[sSummary]
</
td>
<
td class="del">
<
a href="$aData[sLinkDelete]">$lang[Basket_delete]</a>
</
td>
</
tr>
<!-- 
END BASKET_LIST -->
<!-- 
BEGIN BASKET_HEAD -->
<
script type="text/javascript" src="$config[dir_core]checkForm.js"></script>
<div id="basket">
<div class="info">$lang[Basket_info]</div>
<form method="post" action="" onsubmit="return checkForm( this )">
<fieldset id="orderedProducts">
<table cellspacing="0">
<thead>
<tr>
<td class="name">
$lang[Name]
</td>
<td class="price">
<em>$lang[Price]</em><span>[$config[currency_symbol]]</span>
</td>
<td class="quantity">
$lang[Quantity]
</td>
<td class="summary">
<em>$lang[Summary]</em><span>[$config[currency_symbol]]</span>
</td>
<td class="options">&nbsp;</td>
</tr>
</thead>
<tfoot>
<tr id="recount">
<td colspan="2">&nbsp;</td>
<td>
<input type="submit" value="$lang[Basket_update]" class="submit" />
</td>
<td colspan="2">&nbsp;</td>
</tr>
<tr class="summaryProducts">
<th colspan="3">
$lang[Summary]
</th>
<td id="summary">
$aData[sProductsSummary]
</td>
<td>&nbsp;</td>
</tr>
<tr class="buttons">
<td id="save">
<input type="submit" name="sSave" value="$lang[Save_basket]" class="submit" />
</td>
<td colspan="4" class="nextStep">
<input type="submit" name="sNext" value="$lang[Basket_next]&nbsp;&nbsp;>>" class="submit" />
</td>
</tr>
</tfoot>
<tbody>
<!-- END BASKET_HEAD -->
<!-- BEGIN BASKET_FOOT -->
</tbody>
</table>
</fieldset>
</form>
</div>
<!-- END BASKET_FOOT -->
<!-- BEGIN BASKET_EMPTY -->
<div class="message" id="error">
<h3>$lang['Basket_empty']</h3>
</div>
<!-- END BASKET_EMPTY -->

bettywau

bettywau

Avatar: bettywau

2010-11-10 09:58

Lien : <link>href="http://dp.securitelille.free.fr/" </Lien>

bettywau

bettywau

Avatar: bettywau

2010-11-10 09:59

sorry :<link> http://dp.securitelille.free.fr/plugins/boutique/index2.php?lng=fr</link>

bettywau

bettywau

Avatar: bettywau

2010-11-11 16:22

I have modify the file to obtain a drop-down list of quantity available in orders_basket.tpl :

<?php
<td class="quantity">
<
label for="quantity$aData[iProduct]">$lang[Quantity]</label><select name="aProducts[$aData[iProduct]]" " id="quantity$aData[iProduct]" alt="int" />
<option value="
1" {php}($aData[iQuantity] == 1)?"selected=selected":""; {/php} >1</option>
<option value="
2" {php}($aData[iQuantity] == 2)?"selected=selected":""; {/php} >2</option>
<option value="
3" {php}($aData[iQuantity] == 3)?"selected=selected":""; {/php} >3</option>
<option value="
4" {php}($aData[iQuantity] == 4)?"selected=selected":""; {/php} >4</option>
<option value="
5" {php}($aData[iQuantity] == 5)?"selected=selected":""; {/php} >5</option> 
</select>
?>



But that does not work perfectly.
The total price is good but the quantity goes back by default to the last line :quantity 5 when i click on "recount" button

How can i have the good quantity after clic recount in the basket ?

bettywau

beholder

Avatar: beholder

2010-11-11 17:06

Try this hack:
you could edit the templates/orders_basket.tpl file:
<option value="1" $aData[sSelected1] >1</option>
<option value="2" $aData[sSelected2] >2</option>
etc...

and also actions_client/p.php or the core/orders.php listproducts() at a certain place:
$aData['sSelected'.$aData['iQuantity']] = 'selected="selected" ';

beholder

Avatar: beholder

2010-11-11 17:10

btw, I appreciate you fuck with this. Don't stop, you're getting there.

bettywau

Avatar: bettywau

2010-11-11 18:57

Beholder,

Thanks for your help.
<option value="1" $aData[sSelected1] >1</option>
<option value="2" $aData[sSelected2] >2</option>
etc... DONT WORK !! :-(

I don't see "listproducts()" in p.php or order.php..
Where have i to insert : $aData['sSelected'.$aData['iQuantity']] = 'selected="selected" '; ?

beholder

Avatar: beholder

2010-11-11 23:17

there is a listproducts() in core/orders.php, at the very top of the file. You might have looked at wrong order.php.
put in in right after:
foreach( $this->aProducts as $aData ){

bettywau

Avatar: bettywau

2010-11-12 10:50

THANKS A LOT ! It work so good !
Beholder, you're the best !!

Now, in the basket i have a dropdownlist with a limit number quantity of products to 5 !! It so good !

So if you're interessed, edit template/orders_basket.tpl, and find :

<?php 
<td class="quantity">
    <
label for="quantity$aData[iProduct]">$lang[Quantity]</label><input type="text" name="aProducts[$aData[iProduct]]" value="$aData[iQuantity]" size="3" maxlength="4" class="input" id="quantity$aData[iProduct]" alt="int" />onclick="this.form.aProducts[$aData[iProduct]].value=this.selectedIndex;">
  </
td>
?>



Replace by :

<?
<td class="quantity">
<
label for="quantity$aData[iProduct]">$lang[Quantity]</label><select name="aProducts[$aData[iProduct]]" " id="quantity$aData[iProduct]" alt="int" />
<option value="
1" $aData[sSelected1] >1</option>
<option value="
2" $aData[sSelected2] >2</option>
<option value="
3" $aData[sSelected3] >3</option>
<option value="
4" $aData[sSelected4] >4</option>
<option value="
5" $aData[sSelected5] >5</option>
...
</select>
?>



And edit core/orders.php, then as well beholder said, replace :


<?foreach( $this->aProducts as $aData ){ ?>



by :

<?php foreach( $this->aProducts as $aData ){ $aData['sSelected'.$aData['iQuantity']] = 'selected="selected" ';?>




Thanks, thanks, thanks a lot beholder ! I'm so happy !

bettywau

beholder

Avatar: beholder

2010-11-12 11:58

you're welcome, you did your own homework first though.

Back to top
about us | contact