uberbadge_3.gif

This project is not covered by Drupal’s security advisory policy.

The initial idea of this module was to allow custom PHP code to be associated with a product in order to adjust the price of the product. The nature of allowing an admin to enter a block of PHP code to be executed though, allows for much more elaborate and potentially dangerous operations.

Upon installation, this module will add a Custom Code field to your products. Sample uses of this code block are:

$item->price = $item->price;

This will do nothing....but it goes in by default.
$item->price refers to the price before attribute adjustments.

$item->price = $item->price;
if ($item->qty > 5) {
  $item->price = [cost] * 1.1;
}

If more than 5 items are ordered, set the product price to a 10% mark-up of the product cost. Product tokens are exposed to this code so things like [cost], [sell_price], [weight], [weight-raw], etc. can be used.

$item->price = $item->price;
if (date('j', time()) == '1') {
  $item->price = $item->price/2;
}

Half price on the first of each month.

For additional examples which use attributes for price calculations, refer to the Attribute Tokens module.

There are limitless things to do here, but if you are going to get complicated with it you might as well just write a useful module. This also makes no attempt to notify the customer of any of these adjustments, so you'll need to do so in the description of the product.

Thanks to cYu for the original code

Developed by Tom (mrfelton) of Kirkdesigns.

Supporting organizations: 
Development and maintenance

Project information

Releases