Miva Merchant 4 Module FAQs » Product Page Templates (BROK_PRODTEMPLATES )


Using the new attribute quantity feature, I would like to make sure that the customer selects a set number of attributes. For example, I'm selling a three pack of soap and I would like them to select a color for each item in the "pack". How can I go about this?

(2003/08/08)I added a new token, %quantity_required|xxx|% (where xxx is the required quantitiy) which can be used in the main attribute template or the product template (if used in the product template it has to be between the %beginform%..%endform% tokens if they're in the template). It adds a hidden field so that the module can make sure that the quantity selected with the attribute quantity fields matches the required quantities. If the quantitites do NOT match it passes the customer back to the product page and sets the variable g.QuantityError. If the selected quantity is too low, the variable g.QuantityError will have a value of 'low'. If the selected quantity is too high, the variable g.QuantityError will have a value of 'high'.

So, to require that the customer to select three soap colors (three total quantity; they can make all three the same color if they like) to make up their three pack, you would add the token:

%quantity_required|003|% to the attribute main template OR the product template area of the template.

That's all you need to assure that the customer selects exactly enought attributes. To display a message you can use the %begin_if|var|% token to display something by adding something like this to the template:

%begin_if|g.QuantityError EQ 'low'|%
The selected quantity is too low.
%begin_if|g.QuantityError EQ 'high'|%
You selected too many.

This will check the variable g.QuantityError and if it is equal to 'low' it will display one message and if it is 'high' it will display another. Of course you can put a more explanatory note in there than I used in this example.

Last update: 2004-12-07 14:13
Author: Support
Revision: 1.0

Print this record Send FAQ to a friend Show this as PDF file
Please rate this FAQ:

Average rating: 0 out of 5 (0 Votes )

completely useless 1 2 3 4 5 most valuable

You cannot comment on this entry

Records in this category