1and1 Help Centre Categories

print article

What needs to be observerd while creating item rules?

You can define a rule for every item. You can access the current item's attributes
directly (price, item no., quantity, attributes etc.) using the functions
article_get_field(fieldname) and article_set_field(fieldname,fieldvalue):

if (article_get_field('count') < 10) {
article_set_field('hint',"the minimum order quantity for this item is 10 units");

if (article_get_field('specialoffer'))
article_set_field('price',article_get_field('listprice')* 0.95);
// in this case do not forget to create the item attribute "listprice"

Item rules gives you only a restricted PHP4 functionality, which means no
functions, file accesses etc.

Item rules are executed when ordering or when the shopping basket is updated. Any
changes to the item properties will be saved with the order.

Please note:
Item rules must not contain double inverted quotes (speech marks) as they are
transmitted using the HTML tag <input type="hidden" ...> which contains the rule text in speech marks.
Please note:
Because the item rules are carried out whenever the shopping basket is displayed,
the command article_set_field('price',article_get_field('price')* 0.95); does not
work as expected. The price would drop by 5% whenever the shopping basket is
displayed and updated, which would mean that customers could click the price down
at random.