Jump to content

Edit History

Spider A.J.

Spider A.J.

Any idea how to disabling this discount price for products who are allready "on sale"?

if ($order_total >= 1000) $order_total = $order_total_discount + (($order_total - $order_total_discount) * 95/100);

will no work of course because $order_total_discount does not return the value of all products in the other promotion.

In higher versions then 1.4 in classes/CartRule.php there is some code like this:

// Do not give a reduction on free products!

$order_total = $context->cart->getOrderTotal($use_tax, Cart::ONLY_PRODUCTS, $package_products);

          foreach ($context->cart->getCartRules(CartRule::FILTER_ACTION_GIFT) as $cart_rule)

                       $order_total -= Tools::ps_round($cart_rule['obj']->getContextualValue($use_tax, $context, CartRule::FILTER_ACTION_G    IFT, $package), 2);

and there is simple, need to add after this some code like this:

foreach ($package_products as $product)
 //        if($product['on_sale'])
if (Product::isDiscounted((int)$product['id_product'])) 

                       $order_total -= $use_tax ? $product['total_wt'] : $product['total'];

The "//" comment coz in lower versions eg, 1.5 there is no declaration 'on_sale'

but in 1.4 Cart.php there is no such thing like that :(

To explain idea. I need some variable or function  to return allready discounted products in Cart

to not give them 5% discounts but calculate them to >=1000 .

in 1.4 Cart.php there is some above like this:

				/* Secondly applying all vouchers to the correct amount */
				$shrunk = false;
				foreach ($discounts AS $discount)
					if ($discount->id_discount_type != 3)
					{
						$order_total -= Tools::ps_round((float)($discount->getValue(sizeof($discounts), $order_total_products, $shipping_fees, $this->id, (int)($withTaxes))), 2);
						if ($discount->id_discount_type == 2)
							if (in_array($discount->behavior_not_exhausted, array(1,2)))
								$shrunk = true;
					}

but im not pretty sure what return: Tools::ps_round((float)($discount->getValue(sizeof($discounts)

 

Anybody help?

greedzz

SAJ

Spider A.J.

Spider A.J.

Any idea how to disabling this discount price for products who are allready "on sale"?

if ($order_total >= 1000) $order_total =($order_total - $order_total_discount)* 95/100;

will no work of course because $order_total_discount does not return the value of all products in the other promotion.

In higher versions then 1.4 in classes/CartRule.php there is some code like this:

// Do not give a reduction on free products!

$order_total = $context->cart->getOrderTotal($use_tax, Cart::ONLY_PRODUCTS, $package_products);

          foreach ($context->cart->getCartRules(CartRule::FILTER_ACTION_GIFT) as $cart_rule)

                       $order_total -= Tools::ps_round($cart_rule['obj']->getContextualValue($use_tax, $context, CartRule::FILTER_ACTION_G    IFT, $package), 2);

and there is simple, need to add after this some code like this:

foreach ($package_products as $product)
 //        if($product['on_sale'])
if (Product::isDiscounted((int)$product['id_product'])) 

                       $order_total -= $use_tax ? $product['total_wt'] : $product['total'];

The "//" comment coz in lower versions eg, 1.5 there is no declaration 'on_sale'

but in 1.4 Cart.php there is no such thing like that :(

To explain idea. I need some variable or function  to return allready discounted products in Cart

to not give them 5% discounts but calculate them to >=1000 .

in 1.4 Cart.php there is some above like this:

				/* Secondly applying all vouchers to the correct amount */
				$shrunk = false;
				foreach ($discounts AS $discount)
					if ($discount->id_discount_type != 3)
					{
						$order_total -= Tools::ps_round((float)($discount->getValue(sizeof($discounts), $order_total_products, $shipping_fees, $this->id, (int)($withTaxes))), 2);
						if ($discount->id_discount_type == 2)
							if (in_array($discount->behavior_not_exhausted, array(1,2)))
								$shrunk = true;
					}

but im not pretty sure what return: Tools::ps_round((float)($discount->getValue(sizeof($discounts)

 

Anybody help?

greedzz

SAJ

×
×
  • Create New...