Discount vendor target

  • Posts: 77
  • Thank you received: 4
  • Hikashop Business
10 years 5 months ago #130917

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

Last edit: 10 years 5 months ago by Jerome. Reason: [code] is nice

Please Log in or Create an account to join the conversation.

  • Posts: 26007
  • Thank you received: 4004
  • MODERATOR
10 years 5 months ago #130927

Hi,

The variable "proccessed_discount_value" is used by HikaMarket during his vendor total processing but I don't know what/where the discount should be displayed in the invoice.
HikaMarket and HikaShop displayed the total discount when there is a coupon code in the order.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

Moderators: Obsidev
Time to create page: 0.056 seconds
Powered by Kunena Forum