Want a error warning of shippiing method also be triggert in minicart..

  • Posts: 410
  • Thank you received: 9
  • Hikaserial Subscription Hikashop Business
3 years 11 months ago #327470

-- HikaShop version -- : 4.4.0
-- Joomla version -- : 3.9.x
-- PHP version -- : 7.3

Hello,

We get a warning when a certain amount is not yet in the shopping cart, we would like this to be displayed also in the cart in de sidebar.
So when people see how much they still have to put in it before shipping works. :)
See screenshot.
Please help..

Thanks.

Attachments:

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

  • Posts: 4747
  • Thank you received: 644
  • MODERATOR
3 years 11 months ago #327479

Hello,

Can you precise please, how do you set this minimum value per cart, because our answer will certainly vary depending on this elements.
And so, can you precise this through relative settings page screenshot and an url link to your website.

This will allow to better understand the context, and better help you.
Regards

Last edit: 3 years 11 months ago by Philip.

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

  • Posts: 410
  • Thank you received: 9
  • Hikaserial Subscription Hikashop Business
3 years 11 months ago #327538

We have set the minimum price and max for delivery cost via sendmethods. see screenshot..
To go to the shop see second screenshot.


Hikashop

06.bluepoint-concept.nl/test-restaurant-1
This message contains confidential information

Attachments:

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 11 months ago #327545

Hi,

In the product / cart.php view file, you should find the error messages relative to the shipping methods in the variable:
$this->element->usable_methods->shipping_errors
So you can do a var_dump on that variable and then output it how ever you want there.
It requires a bit of PHP knowledge.

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

  • Posts: 410
  • Thank you received: 9
  • Hikaserial Subscription Hikashop Business
3 years 11 months ago #327618

Hi,

I am searching for this: $this->element->usable_methods->shipping_errors as you said in the product/ cart.php view but can not find it anywhere..

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 11 months ago #327641

Hi,

That's normal since the cart module doesn't display the error messages.
But the variable is available in that view file.
As I said, if you do a var_dump of the variable, you'll get the error messages information:
<?php var_dump($this->element->usable_methods->shipping_errors); ?>

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

  • Posts: 410
  • Thank you received: 9
  • Hikaserial Subscription Hikashop Business
3 years 11 months ago #327646

I missunderstood your first reply, sorry,
I did the var dump in the cart file.. see that it does what it needs to only i get an array to show up:
array(3) { [0]=> array(1) { ["min_price"]=> float(10.5) } [1]=> array(1) { ["min_price"]=> float(28) } ["no_rates"]=> string(28) "Geen verzendmethode gevonden" }
and when enough in the cart:
NULL

what am i doing wrong?

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 11 months ago #327650

Hi,

That's normal. The var_dump was just to check that you have the data in the variable.
Now you need to write PHP code to process that data in order to display it.
For example:

if(!empty($this->element->usable_methods->shipping_errors)) {
$shippingClass = hikashop_get('class.shipping');
foreach($this->element->usable_methods->shipping_errors as $error) {
foreach($error as $key => $value) {
 hikashop_display($shippingClass->_displayErrors($key, $value, false), 'error');
}
}
}

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

  • Posts: 410
  • Thank you received: 9
  • Hikaserial Subscription Hikashop Business
3 years 11 months ago #327691

Thanks for this solution, however i get now 2 times the warming, for the limited delivery and the free delivery method. How can i set it so it only shows one warning in the cart??

Thanks..

Attachments:

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 11 months ago #327693

Hi,

You can change the code to:

if(!empty($this->element->usable_methods->shipping_errors)) {
$shippingClass = hikashop_get('class.shipping');
foreach($this->element->usable_methods->shipping_errors as $error) {
foreach($error as $key => $value) {
 hikashop_display($shippingClass->_displayErrors($key, $value, false), 'error');
 break 2;
}
}
}

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

  • Posts: 410
  • Thank you received: 9
  • Hikaserial Subscription Hikashop Business
3 years 11 months ago #327723

Hi,

This is super Thanks!! :)

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

Time to create page: 0.097 seconds
Powered by Kunena Forum