The docs can be your friend. Searching for home found https://docs.zen-cart.com/user/new_u...ome_in_middle/
The docs can be your friend. Searching for home found https://docs.zen-cart.com/user/new_u...ome_in_middle/
Are You Vulnerable for an Accessibility Lawsuit?
myZenCartHost.com - Zen Cart Certified, PCI Compatible Hosting by JEANDRET
Free SSL, Domain, and MagicThumb with semi-annual and longer hosting.
Thank you dbltoe have spent hours over the last few days reading through the docs and missed that somehow, its so long since have used Zencart and had a shopping cart that am lost as it was V1.3.9 when last had one so am a bit lost right now
Looking to customize some of the buttons, i.e. the "previous" "product listing" "next" ones when viewing a product.
Spent lots of time searching for the snip where to add the class, but can't seem to find it.
Appreciate if someone can suggest the file that outputs the following:
<button type="button" class="btn button_prev button_prev">
<button type="button" class="btn button_return_to_product_list button_return_to_product_list">
<button type="button" class="btn button_next button_next">
Which btw repeats the "button_prev", "button_return_to_product_list", and "button_next".
And eventually how to add the extra class.
Thank you
includes/templates/bootstrap/templates/tpl_products_next_previous.php
line 42:
add extra class parm to the zen_image_button function.Code:<a class="p-1" href="<?php echo zen_href_link(FILENAME_DEFAULT, "cPath=$cPath"); ?>"><?php echo zen_image_button(BUTTON_IMAGE_RETURN_TO_PROD_LIST, BUTTON_RETURN_TO_PROD_LIST_ALT); ?></a>
you also have to go outside of the template and look here:
includes/modules/product_prev_next.php
Last edited by carlwhat; 10 Nov 2020 at 04:18 PM.
Thank you.
Actually to customize it I could use the button_prev class generated, I would like to know how to add the extra param in the files (snip of code) you suggested.
apparently you can not add an additional class element like so:
that class gets filtered out. you can do:PHP Code:
echo zen_image_button(BUTTON_IMAGE_RETURN_TO_PROD_LIST, BUTTON_RETURN_TO_PROD_LIST_ALT, 'class="myNewClass"');
that crap does not get filtered out; but it provides no help to what you want to do...PHP Code:
echo zen_image_button(BUTTON_IMAGE_RETURN_TO_PROD_LIST, BUTTON_RETURN_TO_PROD_LIST_ALT, 'crap="myNewClass"');
in looking at the code, i would build an observer. since you are using bootstrap, i would go on the assumption that IMAGE_USE_CSS_BUTTONS is set to 'yes'. if so, i would look to build an observer that hits this event in functions/html_output.php:
adding a class to a ZC generated button seems like a lot of work!PHP Code:
if ($type=='button') {
// link button
// -----
// Give an observer the chance to provide alternate formatting for the button (it's set to an empty string
// above). If the value is still empty after the notification, create the standard-format
// of the button.
//
$GLOBALS['zco_notifier']->notify(
'NOTIFY_ZEN_CSS_BUTTON_BUTTON',
array(
'button_name' => $button_name,
'text' => $text,
'sec_class' => $sec_class,
'parameters' => $parameters,
),
$css_button
);
here is info on building an observer class:
https://docs.zen-cart.com/dev/code/notifiers/
best.
Since you're customizing this unique for your template, you could just skip the use of the zen_image_button function and put your own HTML code in its place.
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
Thank you both.
@carlwhat
I'll try to learn, in the meantime I'll use the class generated
@DrByte
Yes, I did think about it as well, but being at the beginning of a new customization I thought to try to learn a different approach in case needed for more.
@both + rbarbour
However I am puzzled by the double output of "button_prev" class, is it a bug, is it on purpose for reasons beyond my comprehension and knowledge?
I believe the duplication may be a bug. Harmless though.
It's always best to try to style the provided classes if possible (in your own self-added stylesheet), rather than adding more classes to the template.
That said, if you wanted to add your own style, carlwhat was nearly correct when proposing adding a 3rd parameter: it should have been the 4th parameter instead, and be only the name of the class you wanted to add.
eg:
Code:echo zen_image_button(BUTTON_IMAGE_RETURN_TO_PROD_LIST, BUTTON_RETURN_TO_PROD_LIST_ALT, '', 'myNewClass');
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
Bookmarks