Jump to content

Gift on Order


mark2

Recommended Posts

My GiftOnOrder module allows this kind of mechanism.

You define all the voucher you want and associate on gift to each of them.

As soon the voucher is entered in the cart summary and is valid, the gift is automatically added to the card.
You may then have several gift in the card.

Each gift is managed as a standard product, with stock and so on....

Link to comment
Share on other sites

It looks very good. Maybe we will get some feedback on it in this thread. The module seems comprehensive, it is a reasonable price for all that functionality. I am not sure that we need such a flexible module because we have a single use in mind - just associating a voucher with a product.

Link to comment
Share on other sites

Here is a quick hack which should offer this functionality :

Duplicate a product, set the price to zero, set the product to be not active.

Add a discount of 0 euros ending with GIFT-PRODUCT_ID where PRODUCT_ID is the id of the duplicated product

e.g. 1243SDVF-GIFT-1292

modify order.php to add a product if the gift voucher matches

in v1.2.5 :

if (!sizeof($errors)) {
 if (preg_match('/-GIFT-/',$discountName)) {
    $gift_id = preg_replace('/.*-GIFT-/','',$discountName);
    if (!$cart->containsProduct(intval($gift_id),NULL,false)) {
      $cart->updateQty(1, intval($gift_id));
    }
 }
 $cart->addDiscount(intval($discount->id));
 Tools::redirect('order.php');
}



Please let me know if you see a problem with this approach.

Link to comment
Share on other sites

  • 8 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...