Exclude discounted products paying with userpoints

  • Posts: 171
  • Thank you received: 9
8 years 5 months ago #243500

-- HikaShop version -- : 2.6.3

Hi!

As I see now there's no option to set to let the user to pay partially with points for just those products which are not discounted. Could anyone give me some code tricks to solve that?

Or at least to take this to the nearly upcoming "To-Do-List"?

Thanks in advance,

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

  • Posts: 82865
  • Thank you received: 13373
  • MODERATOR
8 years 5 months ago #243522

Hi,

Code tricks ? Well, it would require to remove the code:

if(isset($order->order_subtotal) && isset($order->order_shipping_price)) {
			if($this->plugin_params->allowshipping == 1) {
				$final_price = @$order->order_subtotal + $order->order_shipping_price;
			} else {
				$final_price = @$order->order_subtotal;
			}
		} else if(empty($order->cart->full_total->prices[0]->price_value_with_tax)) {
			if($this->plugin_params->allowshipping == 1) {
				$final_price = @$order->full_total->prices[0]->price_value_with_tax;
			}else{
				$final_price = @$order->total->prices[0]->price_value_with_tax;
			}
			if(!empty($order->additional['userpoints']->price_value_with_tax)){
				$final_price -= $order->additional['userpoints']->price_value_with_tax;
			}
		} else {
			if($this->plugin_params->allowshipping == 1) {
				$final_price = @$order->cart->full_total->prices[0]->price_value_with_tax;
			} else {
				$final_price = @$order->cart->total->prices[0]->price_value_with_tax;
			}
			if(!empty($order->cart->additional['userpoints']->price_value_with_tax)){
				$final_price -= $order->cart->additional['userpoints']->price_value_with_tax;
			}
		}
in the file plugins/hikashoppayment/userpoints/userpoints.php and add instead a loop on the products array (in $order->products or $order->cart->products) to see in each product if there is a discount attribute or not and then sum the product price if there is no discount attached to the product.
If you're a developer, it's easy to change.

The following user(s) said Thank You: pepecortez

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

Time to create page: 0.042 seconds
Powered by Kunena Forum