- Posts: 57
- Thank you received: 4
WISHLIST - Override the function
- rfernandes
-
Topic Author
- Offline
Less
More
11 years 4 months ago #201081
by rfernandes
WISHLIST - Override the function was created by rfernandes
Hi guys,
I need your help.
Can you tell me how can I override a function to wishlist?
For example, I have created a new plugin to override diferent views like product_page_view, listing view, compare view, mini-cart view, checkout view and now only less me the wishlist view.
To do that I have created a new plugin like:
and I have tried inside this functions to put for example if($view->getLayout() == 'wishlist') but I don't have any results.
Can you help me please, to discover where I can do that and what name of function I need to solve my problem?
Thanks.
I need your help.
Can you tell me how can I override a function to wishlist?
For example, I have created a new plugin to override diferent views like product_page_view, listing view, compare view, mini-cart view, checkout view and now only less me the wishlist view.
To do that I have created a new plugin like:
Code:
class plgHikashopOverrideData extends JPlugin
{
function plgHikashopOverrideData(&$subject, $config)
{
...
}
# function to override diferent views in hikashop
function onHikashopBeforeDisplayView(&view)
{
...
if($view->getName() == 'product')
{
if($view->getLayout() == 'show')
{
// for product page
}
elseif($view->getLayout()=='compare')
{
// for compare page
}
else
{
// for other views
}
}
]
# function to cart and checkout
function onAfterCartProductsLoad(&cart)
{
...
}
}
and I have tried inside this functions to put for example if($view->getLayout() == 'wishlist') but I don't have any results.
Can you help me please, to discover where I can do that and what name of function I need to solve my problem?
Thanks.
Please Log in or Create an account to join the conversation.
11 years 4 months ago #201082
by Xavier
Replied by Xavier on topic WISHLIST - Override the function
Hi,
Why not use the views override system ?
Here is the documentation for that:
www.hikashop.com/support/support/documen...ize-the-display.html
Else the view name is "cart" and the layout is "showcart", but the same view is used for both cart and wishlist so you will have do to some checks to edit only the wishlist layout, or you can edit both.
Why not use the views override system ?
Here is the documentation for that:
www.hikashop.com/support/support/documen...ize-the-display.html
Else the view name is "cart" and the layout is "showcart", but the same view is used for both cart and wishlist so you will have do to some checks to edit only the wishlist layout, or you can edit both.
Please Log in or Create an account to join the conversation.
- rfernandes
-
Topic Author
- Offline
Less
More
- Posts: 57
- Thank you received: 4
11 years 4 months ago #201226
by rfernandes
Replied by rfernandes on topic WISHLIST - Override the function
Hi,
Thanks for you answer.
Override the view isn't a option because I have an WebService to set the objects that we wan't.
For example, I'm setting the product prices, product quantities, disconts, stock and expedition from an external DB and get all this information with an Soap Webservice.
Everything works with all view, except wishlist view.
So, how can I set for example $row->elements (products) in wishlist using my plugin to override?
Thanks for you answer.
Override the view isn't a option because I have an WebService to set the objects that we wan't.
For example, I'm setting the product prices, product quantities, disconts, stock and expedition from an external DB and get all this information with an Soap Webservice.
Everything works with all view, except wishlist view.
So, how can I set for example $row->elements (products) in wishlist using my plugin to override?
Please Log in or Create an account to join the conversation.
11 years 4 months ago #201245
by nicolas
Replied by nicolas on topic WISHLIST - Override the function
Hi,
It's normal that you can't use the onHikashopBeforeDisplayView(&view) trigger to override that wishlist/cart view as it would require the addition of this attribute in the class of the file components/com_hikashop/views/cart/view.html.php :
var $triggerView = true;
But then you could simply call that onHikashopBeforeDisplayView trigger yourself from the showcart view override and you would be able to do that without hacking in the view.html.php file.
It's normal that you can't use the onHikashopBeforeDisplayView(&view) trigger to override that wishlist/cart view as it would require the addition of this attribute in the class of the file components/com_hikashop/views/cart/view.html.php :
var $triggerView = true;
But then you could simply call that onHikashopBeforeDisplayView trigger yourself from the showcart view override and you would be able to do that without hacking in the view.html.php file.
Please Log in or Create an account to join the conversation.
- rfernandes
-
Topic Author
- Offline
Less
More
- Posts: 57
- Thank you received: 4
11 years 4 months ago #201384
by rfernandes
Replied by rfernandes on topic WISHLIST - Override the function
Hi nocolas.
I'm sorry but I don't understood very well what you tried to explain.
Can you please explain better ou show me a sample to understand what you tried to said?
Thanks.
I'm sorry but I don't understood very well what you tried to explain.
Can you please explain better ou show me a sample to understand what you tried to said?
Thanks.
Please Log in or Create an account to join the conversation.
11 years 4 months ago #201387
by nicolas
Replied by nicolas on topic WISHLIST - Override the function
Hi,
Edit the file "showcart" of the view "cart" via the menu Display>Views and add the code:
at the beginning of the file and the onHikashopBeforeDisplayView function of your custom hikashop plugin will be called when you display the wishlist details page.
Edit the file "showcart" of the view "cart" via the menu Display>Views and add the code:
Code:
<?php
JPluginHelper::importPlugin('hikashop');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('onHikashopBeforeDisplayView', array(&$this));
?>
Please Log in or Create an account to join the conversation.
Time to create page: 0.193 seconds