I am using prestashop 1.7 and want to disable the popup and instead call a custom javascript function that toggles my shopping cart visible.
I found various instructions, however I don't have a file called ps_shoppingcart.js. The only one I have is the ps_shoppinccart.tpl which contains the HTML template.
Can someone help me to find where I can do the toggle?
If you take a look at the code of the master file of the module (ps_shoppingcart.php), you will see in the hookHeader() that the ps_shoppingcart.js is skipped when the option "Ajax cart" is turned off, so, you can remove these validation to keep the JS file loaded and in the file every time and now you can add your custom code, the code which show the popup is this:
if (resp.modal) {
showModal(resp.modal);
}
Hope this help you!
Related
I have added one module custom html box in PrestaShop 1.7 . Module is installed but you can use it only once .can i create multiple list of htmlbox?
This depend on the module, but if you are using htmlbox module, yes, the free version is programmed to only be used 1 time in 1 place.
But there are two options to do this without any developed module.
1st option:
You have the option to include these html code directly in the tpl of the activated theme.
In prestashop 1.7 version we have a new feature that, if you are in mode developer ("Advanced parameter" -> "Performance"), in the html you can see in what template is located any element.
For example, to add a code above the slider of the home page, if you inspect the element you can see this:
In the "begin" tag you have the template that you need to modify.
2nd option:
You can create a new module and use the display hooks correctly.
Here you have all that you need to know about the creation of modules.
http://developers.prestashop.com/module/05-CreatingAPrestaShop17Module/
I need the javascript tracking code to appear before the closing tag after the app installation
Is there any way to add a custom js code via API or something
To add tracking code to the head you need to edit the Panels/HTMLHead.html file.
To edit this file go to
{store_url}/admin/designmode.php?ToDo=editFile&File=Panels/HTMLHead.html&f=a
Hope that helps
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'}.