I'm trying to show a module in just one category.
I've created the module, assigned to Position6
Then I've inserted this:
{if $category->id == 10} {$displayPosition6} {/if}
in category.tpl but nothing happens.
What am i doing wrong?
Thanks
Try removing "if clause" and see if it works. Make sure that your tpl file is at correct location:
/views/templates/front/: front office features.
/views/templates/admin/: back office features.
/views/templates/hook/: features hooked to a PrestaShop (so can be displayed either on the front office or the back office)
Related
I am new to prestashop and using 1.6 version. I am creating a module which will show cart summary in pop up box after adding product into cart. The process of adding product into cart will be triggered, when customer clicks on "Add to cart" button.
So, i want to change the current functionality of "Add to cart button" and put my functionality on this.
I have searched many things on this, but everyone telling me that, this can be achieved by overriding tpl file. Its ok, but i have question on this that, if i override tpl file and after that user disable my module module then in that case, will overrided tpl file work??. Disable means just disable its functionality not uninstall the module.
So, please any one clear my confusion on this and tell me the right solution of how can i change the current functionality of "Add to cart" button and put my funcationality, when my module is enable??
Waiting for solution.
The best approach is to do an override, by copying the default template, and just remove/add code from it based on that if the module is enabled or disabled/uninstalled. These are just simple IFs, like:
{if Module::isInstalled('socialsharing')}
<div>SOCIAL</div>
{else}
<div>NO SICIAL</div>
{/if}
If course instead of isInstalled() method you can use isEnabledForShopContext() & isEnabled()
I'm using PS version 1.5.6.2. When we disable a product or if product gets deleted then we see a message like
THERE IS 1 ERROR
This product is no longer available.
I want to add a 404.tpl file in place of this. Is it possible ?
I have gone through the productcontroller.php and added some codes to display the tpl file but didn't get any success.
Please help me if you can.
You don't need to include the template file yourself, the Tools class has a method display404Error for this:
// check whatever you want in the method your want
if (!$this->product->available_for_order) {
Tools::display404Error();
}
I want to change the layout of prestashop back office product page.
So can anyone tell me which file to change so that I can modify this existing layout?
I don't know which page you want to edit exactly, but when you go to that page in your backoffice, like:
http://www.example.com/admin123/index.php?tab=AdminAttributesGroups
The admin123 is variable to your installation, but the ?tab=AdminAttributesGroups referes to the backoffice page you are on. These pages are located in /var/www/admin123/tabs in this case it's /var/www/admin123/tabs/AdminAttributesGroups.php
I found the solution.... Here is what I did
Added content.tpl in under adminxxyy/theme/theme_name/template/controller/products
Which showed me content of my content.tpl
Create a new module, register the hook and send that info via hook to content.tpl.
Use hook name in content.tpl like {hook h='displayProductMyWay' mod='blockcustom'}.
I try to modify a module template in prestashop so I've copied the module to my theme folder "modules".
I've noticed that the theme is changing the only problem is that the translation is not. I got the original text on the final shop template. Is there some simple way of making this work?
I don't know how to make modules so this way was great except the translation part - the rest of the store is translated except those modules. I use prestashop 1.4.
In your Back Office, you need to edit the Module Translations under Tools > Translations > Modify Translations. They are translated separately from the Front Office and Back Office translations, just select "Modules" from the drop-down menu.
Make sure your module can be translated also :
{l s='Login' mod='blockuserinfo'}
The name of the module has to be here,
also make sure to check the prestashop user guide :
http://doc.prestashop.com/display/PS15/Translations+in+PrestaShop+1.5
I have a component with several categories of games and I want to display a different banner depending on the category. I need the banner (and link) to be customizable so it's not simply a case of showing categoryX.jpg or whatever.
I saw this Joomla help page on another question, but it only seems to display a module type, not one specific module. I'd like to use various mod_custom modules and display the one appropriate to the category (I can store each module's ID if necessary).
Any ideas?
This can be done in a 2 step process:
Use the "Load module into article" plugin to allow yourself to access the module using a plugin call like:
{module [*mod_id*]} // where *mod_id* is the module id
Now that you can call a plugin to put your module anywhere, you now need to go to the view code of your/a component you wish to add the module to and add this code:
echo JHTML::_('content.prepare', '{module [*mod_id*]}');
Please see this link - http://www.alltogetherasawhole.org/group/developers/forum/topics/running-joomla-content-plugins - regarding point number 2. I was trying to do the same thing and I found it didn't work, and the reason for this was a comment you can find on the page link above:
"I noticed that some plugin actually expect option=com_content for them to process onPrepareContent properly, so you might actually want to "fool" them by callin JRequet::setVar and restoring the correct values after the trigger."
If you would like to show module within PHP code then use this code, it's worked for me :
<?php echo JHTML::_('content.prepare', '{loadposition position-2}'); ?>
If you want to show module inside html content then just put this code where you want to show module.
{loadposition position-2}
It loads all modules which are assigned to position-2.
You can also use the Joomla Module Renderer
$doc = JFactory::getDocument();
$renderer = $doc->loadRenderer('modules');
$position = 'custom_position_name';
$options = array('style' => 'raw');
echo $renderer->render($position, $options, null);
Just a heads up, Along with being assigned the module position, that module also has to be set to "Display on All pages".
Joomla has this functionality built in. You can use the {loadposition XX} command within your content items. You can specify custom module positions that do not appear in your template to insure that you have the correct module in the correct article.
http://docs.joomla.org/How_do_you_put_a_module_inside_an_article%3F
You could create a new module?
If each category appears in the querystring (catid=X) then you could take a similar approach to https://support.pillwax.com/open-source/doku.php?id=joomla:header_image.
Alternatively, that link might actually do it for you.