Zero Weight Warning

  • Posts: 306
  • Thank you received: 42
  • Hikamarket Multivendor Hikashop Business
9 years 8 months ago #225751

-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.4.8
-- PHP version -- : 5.4.29

I am using a shipping method which is calculated on weight, Is there a way of issuing a warning if a product or option is added without a weight set?

Thanks
Trevor

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

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
9 years 8 months ago #225753

Hi,

It depends on the context you're referring.

In HikaShop ; there is a message displayed when you save a product without a weight.
In HikaMarket, there is no message but that's something which can be add.

Now, it is possible to create a custom plugin for HikaShop and HIkaMarket in order to refuse the creation of a product if it does not have a weight. Or that plugin can just display a warning.

Otherwise, I can be possible with a mass action to force a product to have a weight if a user is creating a product without one.
With the product creation event and a filter on the 0 product weight ; you can set a new weight for the product.
But there is no action in the mass actions to display a message in the interface ; it could be something interesting.

I hope that my explanations will help you.

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.

  • Posts: 306
  • Thank you received: 42
  • Hikamarket Multivendor Hikashop Business
9 years 8 months ago #225787

For me the best option would be to display the warning when the product is when a physical product is saved from the front end. I guess others might want a similar message if the size is missing.

The ability to create warning messages with a mass action could be very useful.

I have set up a mass action to add a small weight when the product is saved but it is not the best solution for me.

Thanks
Trevor

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

  • Posts: 26274
  • Thank you received: 4045
  • MODERATOR
9 years 8 months ago #225835

Hi,

I let a feature request for the HikaShop team about the "user message" using a mass action.

Some store are selling virtual products, so they don't want a weight (they can also propose both kind of products).
That's why, I'm not fan of adding such kind of message directly in HikaMarket ; it could disturb some users or create confusion.
A plugin is, in some way, better because it is something you can activate/deactivate depending your needs.

www.hikashop.com/support/support/documen...onAfterProductCreate

public function onAfterProductCreate(&$element) {
   $app = JFactory::getApplication();
   $config = hikashop_config();
   if($app->isAdmin() || !empty($element->product_weight) || $config->get('force_shipping', 0))
      return;

   $db = JFactory::getDBO();
   $db->setQuery('SELECT shipping_id FROM '.hikashop_table('shipping').' WHERE shipping_published = 1');
   if($db->loadResult())
      $app->enqueueMessage( JText::_('SHIPPING_METHODS_WONT_DISPLAY_IF_NO_WEIGHT') );
}

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.

  • Posts: 306
  • Thank you received: 42
  • Hikamarket Multivendor Hikashop Business
9 years 8 months ago #225933

Thanks Jerome

The mass action User Message could have lots of uses.

I agree that the plugin is the best way to go. I tried to build one today but couldn't get it to trigger either onAfterProductCreate(&$element) or onAfterProductUpdate(&$element) when the product was saved. I will look again tomorrow when I have more time.

Thanks
Trevor

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

Time to create page: 0.069 seconds
Powered by Kunena Forum