manufacturer and coupon


  • Default avatar
    olizan    
     12 years ago
    0

    hello,

    i'll would have a rule : 20% on manufacturer A with a minimum value 45€ ONLY on this manufacturer.

    how to restrict the coupon to the manufacturer, not the total if they are other manufacturer ?

    Could you help me ?

    regards

    olivier
  • Your avatar
    seyi    
     12 years ago
    0

    this requires customization, as the minimum value works just on the order total. Here is code that can do it, but it will always work this way for manufacturer specific coupons if you select a minimum value.

    Version 1.4.1
    in www/administrator/components/com_awocoupon/assets/virtuemart/ps_coupon_process.php, around line 571, right after the start of the if statement
    <?php
    if($coupon_row->function_type2_mode == 'include') {
    ?>

    but before
    <?php
    // inclusive list of manufacturers
    ?>


    add this
    <?php
    // verify total is up to the minimum value for the coupon
    if (!empty($coupon_row->min_value)) {
        
    $manu_total 0;
        foreach(
    $coupon_row->cart_items as $row) { 
            if(isset(
    $coupon_row->manufacturerlist[$coupon_row->cart_items_def[$row['product_id']]['manufacturer']])) 
                
    $manu_total += $row['qty'] * $row['product_price'];
        }
        if (
    $manu_total<$GLOBALS['CURRENCY']->convert$coupon_row->min_value )) {
            return 
    $this->return_false('errMinVal');
        }    
    }
    ?>


    Note this is untested code, so test properly before using in production environment.