create product plugin

  • Posts: 120
  • Thank you received: 2
9 years 4 months ago #181030

Hi dear
May be create a product plugin for show data in product page? I can not found document.

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

  • Posts: 13201
  • Thank you received: 2322
9 years 4 months ago #181052

Hi,

Here is the documentation for the plugins:
www.hikashop.com/support/support/documen...r-documentation.html

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

  • Posts: 120
  • Thank you received: 2
9 years 4 months ago #181132

Thank you dear Xavier
I want show custom plugin's data on display product block in front end use this method?
onAfterProductCreate(&$element)
for example see demo url
demo.hikashop.com/index.php?option=com_h...e=&Itemid=78&lang=en
I want create custom plugin and show data on product page.

Last edit: 9 years 4 months ago by kaya.

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

  • Posts: 13201
  • Thank you received: 2322
9 years 4 months ago #181138

Hi,

If you just want to display custom data on product page, you can use the custom fields.
The trigger onAfterProductCreate(&$element) allow to do action after a product is created, not when displayed.

Here is the documentation for the custom fields:
www.hikashop.com/support/support/documen...shop-field-form.html

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

  • Posts: 120
  • Thank you received: 2
9 years 4 months ago #181264

but I do not want use custom field I want develop a plugin if say me what trigger I can use I can develop my plugins.
thank you.

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

  • Posts: 81515
  • Thank you received: 13068
  • MODERATOR
9 years 4 months ago #181287

Hi,

In that case, you want to implement the onHikashopBeforeDisplayView www.hikashop.com/support/support/documen...hopBeforeDisplayView trigger and add your custom HTML as an element of an attribute array (these arrays are available : topBegin topEnd leftBegin leftEnd rightBegin rightMiddle rightEnd bottomBegin bottomMiddle bottomEnd) of the object $view->element->extraData

So for example:

function onHikashopBeforeDisplayView(&$view){
$viewName = $view->getName();
$layout = $view->getLayout();
if($viewName!='product' || $layout!='show') return;
 $view->element->extraData->topBegin[]='my text at the top of the product page';
}

The following user(s) said Thank You: kaya

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

  • Posts: 120
  • Thank you received: 2
9 years 4 months ago #181400

thank you dear nicolas
your code work now how can show data on under product image? or it's work only top of the product?

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

  • Posts: 13201
  • Thank you received: 2322
9 years 4 months ago #181422

Hi,

You can edit the view "product / show_default" move:

<?php if(!empty($this->element->extraData->topEnd)) { echo implode("\r\n",$this->element->extraData->topEnd); } ?>
Just after the product image display code, and then in your plugin add extradata for "topEnd" like:
$view->element->extraData->topEnd[]='my text just after the image';

The following user(s) said Thank You: kaya

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

  • Posts: 120
  • Thank you received: 2
9 years 4 months ago #181537

Hi dear Xavier
Thank you I do not want core hack I want do it without core hack. if is possible do it without core hack help me.
thank you very much.

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

  • Posts: 81515
  • Thank you received: 13068
  • MODERATOR
9 years 4 months ago #181552

Hi,

First, view overrides via the menu Display>Views of HikaShop are NOT core hacks. They are stored as view overrides and are not lost when you update your shop.
Second, I already explained that you could use other places on the page with the other arrays available in the code of the plugin:
topBegin topEnd leftBegin leftEnd rightBegin rightMiddle rightEnd bottomBegin bottomMiddle bottomEnd

So it's like that for the bottom of the image:

$view->element->extraData->leftEnd[]='my text at the bottom of the image';

The following user(s) said Thank You: kaya

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

  • Posts: 120
  • Thank you received: 2
9 years 4 months ago #181608

Thank you dear nicolas
This is exactly what I wanted

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

Time to create page: 0.084 seconds
Powered by Kunena Forum