Items Blocked

  • Posts: 54
  • Thank you received: 0
8 years 5 months ago #243748

I am using the price per item shipping item to block certain items that can't be shipped overseas. Is it possible to display what items can't be shipped to someone who add these to their cart, rather than "the cart contains..." message as the customers have items that can be shipped too and they wont know what product is the 'problem'?

Thanks

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

  • Posts: 12953
  • Thank you received: 1778
8 years 5 months ago #243760

Hello,

That's not possible for the moment but that's a good idea, we'll integrate it so that in that case instead of displaying :
"There are %s items in your cart which we cannot ship to you"

It will display something like :
"The 'product name' product in your cart cannot be shipped to you"

We'll develop and test it on our end as fast as possible, and then get back to you !

Thank you for your feedback !

The following user(s) said Thank You: lousyfool

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

  • Posts: 12953
  • Thank you received: 1778
8 years 5 months ago #243846

Hello,
We just developed it and will add it through the next Hikashop version, but if you want it now, you'll have to edit the file :

- administrator\components\com_hikashop\classes\shipping.php" and change these lines

case 'product_excluded':
	$value = 'X_PRODUCTS_ARE_NOT_SHIPPABLE_TO_YOU';
	break;
default:
	$value = $key;
	break;
}
By
		default:
			$value = $key;
			break;
	}
}elseif(is_string($value)) {
	$number = $value;
	$value = $key;
- administrator\components\com_hikashop\helpers\helper.php" and change these lines
$price = 0;
foreach($order->products as $k => $row) {
	if(!empty($rate->products) && !in_array($row->product_id, $rate->products))
		continue;
		if(isset($rate_prices['products'][$row->product_id])) {
		$price += $rate_prices['products'][$row->product_id];
		$rate_prices['products'][$row->product_id] = 0;
	} elseif(isset($rate_prices['products'][$row->product_parent_id])) {
		$price += $rate_prices['products'][$row->product_parent_id];
		$rate_prices['products'][$row->product_parent_id] = 0;
	} elseif(!isset($rate->shipping_params->shipping_virtual_included) || $rate->shipping_params->shipping_virtual_included || $row->product_weight > 0) {
		$price += $rate_prices['price'] * $row->cart_product_quantity;
	}
}
if($price > 0) {
	if(!isset($rate->shipping_price_base))
		$rate->shipping_price_base = hikashop_toFloat($rate->shipping_price);
	else
		$rate->shipping_price = $rate->shipping_price_base;
	$rate->shipping_price = $currencyClass->round($rate->shipping_price + $price, $currencyClass->getRounding($rate->shipping_currency_id, true));
}
if($price < 0) {
	if(!isset($rate->errors['product_excluded']))
		$rate->errors['product_excluded'] = 0;
	$rate->errors['product_excluded']++;
}
By
$price = 0;
$rate_prices['products']['product_names'] = array();
foreach($order->products as $k => $row) {
	if(!empty($rate->products) && !in_array($row->product_id, $rate->products))
		continue;

	if(isset($rate_prices['products'][$row->product_id])) {
		$price += $rate_prices['products'][$row->product_id];
		if($rate_prices['products'][$row->product_id] < 0)
			$rate_prices['products']['product_names'][] = '"' . $row->product_name . '"';
		$rate_prices['products'][$row->product_id] = 0;
	} elseif(isset($rate_prices['products'][$row->product_parent_id])) {
		$price += $rate_prices['products'][$row->product_parent_id];
		$rate_prices['products'][$row->product_parent_id] = 0;
	} elseif(!isset($rate->shipping_params->shipping_virtual_included) || $rate->shipping_params->shipping_virtual_included || $row->product_weight > 0) {
		$price += $rate_prices['price'] * $row->cart_product_quantity;
	}
}
if($price > 0) {
	if(!isset($rate->shipping_price_base))
		$rate->shipping_price_base = hikashop_toFloat($rate->shipping_price);
	else
		$rate->shipping_price = $rate->shipping_price_base;
	$rate->shipping_price = $currencyClass->round($rate->shipping_price + $price, $currencyClass->getRounding($rate->shipping_currency_id, true));
}
if($price < 0) {
	$rate->errors['X_PRODUCTS_ARE_NOT_SHIPPABLE_TO_YOU'] = implode($rate_prices['products']['product_names'], ', ');
}
- Edit your translation file and change that line
X_PRODUCTS_ARE_NOT_SHIPPABLE_TO_YOU="There are %s items in your cart which we cannot ship to you"
By
X_PRODUCTS_ARE_NOT_SHIPPABLE_TO_YOU="The %s item(s) in your cart cannot be shipped to you"

Last edit: 8 years 5 months ago by Mohamed Thelji.
The following user(s) said Thank You: lousyfool

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

  • Posts: 54
  • Thank you received: 0
8 years 5 months ago #243881

Thanks for that, that's great news. When you propose that the build will be released?

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

  • Posts: 12953
  • Thank you received: 1778
8 years 4 months ago #243894

Hello,

That modification will be added on the next Hikashop release but we don't have an established date for the moment.

The following user(s) said Thank You: lousyfool

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

Time to create page: 0.061 seconds
Powered by Kunena Forum