Hi,
I used the modified code from AWO Coupon to add a dscount coupon also t the vendor.
Since the last upgrade of HikaMarket, it does not work anymore.
The discount is applied to the vendor, BUT the vendor order (invoice) ist still displayed without the discount.
I used the following code:
if(class_exists('hikamarket')) {
$object->discount_target_vendor = 1;
$hikamarket_config = hikamarket::config();
$totaldiscount_str = $hikamarket_config->get('calculate_vendor_price_with_tax',false) ? 'totaldiscount' : 'totaldiscount_notax';
$object->products = array();
foreach($cart->products as $product) {
foreach($coupon_session['cart_items'] as $item) {
if($product->product_id == $item['product_id']) {
if(isset($product->variants)) {
foreach($product->variants as $variant) {
$tmp_product = clone($variant);
$tmp_product->processed_discount_value =round($item[$totaldiscount_str],2);
$object->products[] = $tmp_product;
}
}
else {
$tmp_product = clone($product);
$tmp_product->processed_discount_value =round($item[$totaldiscount_str],2);
$object->products[] = $tmp_product;
}
break;
}
}
}
}
Any tips, why it does not work anymore ?
Thanks and br