How to call a plugin from an article

  • Posts: 13
  • Thank you received: 0
  • Hikashop Essential
3 years 11 months ago #317691

-- url of the page with the problem -- : duchampdrive.fr
-- HikaShop version -- : 4.2.3
-- Joomla version -- : 3.9.16
-- PHP version -- : 7.3.16
-- Browser(s) name and version -- : Firefox 68
-- Error-message(debug-mod must be tuned on) -- : None

Dear,

I would like to create a shipping module to show the shipping option available that are shown on the check-out page (My shipping options keep changing). For that I try to create a Custom HTML Modules ( www.kksou.com/php-gtk2/joomla/how-to-run...tom-html-modules.php ) using the 'Hikashop manual shipping plugin' plugin instead, but I don't find the plugin name and argument I should write the in.
I tried to include the following code but it does not work:
{plg_hikashopshipping_manual}
Can you please provide the command that should be included.

Thank you in advance
Martial

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

  • Posts: 81361
  • Thank you received: 13037
  • MODERATOR
3 years 11 months ago #317710

Hi,

The instructions on that link are only for plugins of the group "content" which are meant to display HTML in Joomla articles. The shipping plugins of HikaShop are not content plugins. They are plugins of the group "hikashopshipping" made to display shipping methods during the checkout of HikaShop.
So you won't be able to achieve what you want with these instructions.
However, there is probably another solution to achieve what you want. Could you describe how your shipping options keep changing so that we can better understand what is your need ?

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

  • Posts: 13
  • Thank you received: 0
  • Hikashop Essential
3 years 11 months ago #317726

Hi,

Thank you for your reply.
You can find the shipping options at:
duchampdrive.fr/index.php/horaire-de-retrait-livraison
You can see they are day dependent and they will change continuously over the year. Right now, I have input them as text in an article.

If you do the checkout, you will get the attached options at the shipping stage, that I have input in hikashop/shipping. I would like the attached page to be in displayed at: duchampdrive.fr/index.php/horaire-de-retrait-livraison

Do you think it is possible?
Thank you
Martial

Attachments:

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

  • Posts: 81361
  • Thank you received: 13037
  • MODERATOR
3 years 11 months ago #317729

HI,

OK, I think I understand what you're trying to do.
You want the shipping methods selection area of the checkout to be displayed on its own on another page so that you don't have to enter the shipping information both in HikaShop and in a Joomla article but only in HikaShop.
That won't be possible to do it like that unless there is some code development.
What I would recommend is to change your Joomla article to include in it some PHP to retreive the shipping methods available and display them.
The PHP is not that long. It should be something like that:

<ul>
<?php
if(!defined('DS'))
	define('DS', DIRECTORY_SEPARATOR);
include_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php');
$pluginClass = hikashop_get('class.plugins');
$rates = $pluginClass->getMethods('shipping', '', '', $currency);
foreach($rates as $rate) {
echo '<li><strong>'.$rate->shipping_name.'</strong><br/>'.$rate->shipping_description.'</li>';
}
?>
</ul>
And here is an article on how to add PHP code in a Joomla article:
www.technetexperts.com/web/steps-to-writ...e-in-joomla-article/

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

  • Posts: 13
  • Thank you received: 0
  • Hikashop Essential
3 years 11 months ago #317796

Hi Nicolas,

It is almost perfect but it displays both the 'published' and 'un-published' shipping options. Could I add something in the previous code to show only the published sipping option. Thank you in advance.

Martial

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

  • Posts: 81361
  • Thank you received: 13037
  • MODERATOR
3 years 11 months ago #317798

Hi,

Sure. After the line:
foreach($rates as $rate) {
just add:
if(empty($rate->shipping_published)) continue;

The following user(s) said Thank You: martial.duchamp@gmail.com

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

  • Posts: 13
  • Thank you received: 0
  • Hikashop Essential
3 years 11 months ago #317833

Excellent. I works very well. Thank you.

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

Time to create page: 0.056 seconds
Powered by Kunena Forum