Tutorial to have unique items

sergeh

Avatar: sergeh

2006-10-08 00:55

Hey guys,

I know a lot of people only sell unique items in their stores, meaning that they only have 1 of each and right now Quick Cart doesn't let you define the quantity of each items. So I thought I'd make a simple tutorial on how you can restrict your customers to only be able to add 1.

this is for version 1.4 but it should work for all of 1.x if I'm not mistaken

STEP 1

-open templates/products_more.tpl

-find the <form> tags and you can either remove the input box for the quantity or you can disable it. I chose to disable it by doing:

<input type="text" name="iQuantity" value="1" maxlength="3" size="2" disabled="disabled" />

if you choose to remove it then delete that line and $lang[Quantity]

- Now you need to add a hidden field so that when the form is processed only 1 item is added
so you need to add this

<input type="hidden" name="iQuantity" value="1" />

right under

<input type="hidden" name="iProduct" value="$aData[iProduct]" />

Repeat all that for templates/pa.products_more.tpl

STEP 2

If you're using the plugin productAttributes you'll need to open templates/productAttributes.tpl and replace

<input type="text" name="iQuantity" value="1" maxlength="3" size="2" />

with

$aList[iQuantity]

If you're NOT using productAttributes then open templates/orders_basket.tpl

and replace

<input type="text" name="iQuantity" value="1" maxlength="3" size="2" />

with $aList[iQuantity]

STEP 3

- open core/orders.php

find these lines (should be around line 59)

if( isset( $aBasket ) && is_array( $aBasket ) ){
$aBasket[3] += $iQuantity;
dbSaveOrderProduct( $aBasket );
}
else{
dbAddOrderProduct( $aData, $iQuantity, $iOrder );
}

and replace them with

if( !isset( $aBasket ) && !is_array( $aBasket ) ){
dbAddOrderProduct( $aData, $iQuantity, $iOrder );
}


DONE!

After this your users will only be able to add 1 item of each
Hope this helps someone!

OPX

No avatar

2006-10-08 04:23

I can't find

<input type="text" name="iQuantity" value="1" maxlength="3" size="2" />



In step 2

sergeh

Avatar: sergeh

2006-10-08 05:58

hmm I really should have verified before posting this lol

this is the correct line, it's the only input in that page anyways

<input type="text" name="aElements[$aList[iElement]]" value="$aList[iQuantity]" maxlength="3" size="2" />

wish there was a way to edit my post... :S

OPX

No avatar

2006-10-08 23:55

:P

Now works. Thx

Back to top
about us | contact