Jump to content


  • Posts

  • Joined

  • Last visited

Posts posted by Jurist

  1. You said:


    in php
    $this->smarty->assign(array('tax' => $_COOKIE['tax']));
    but where exactly in php? I am trying to create override for Group.php
    class Group extends GroupCore
    public static function getPriceDisplayMethod($id_group)
    		$this->smarty->assign(array('tax' => $_COOKIE['tax']));
    		if($_COOKIE['taxDisplay'] == 0) 
    			return 1;
    		else return 0;

    but it gives internal server error.


    Where should I add that php code?



  2. Hi,


    My idea is simple: there's one login form (just like in PS1.7), if customer enters password he has account created if not he is guest. 


    I've almost managed to solve this, just got one issue. 


    Could someone from prestashop tell me how to create condition on authentication page in <form id="account-creation_form" creat condition:


    if customers inserts all the necessary data and inserts password then standard Customer account is created


    or customers inserts all the necessary data and does not inserts password then guest account is created?


    I will try to share the solution if I manage to have it done. 



  3. I've found temporary resolution to fix $p variable, at the moment I just removed url rewriting from mydomain.com/themes/my-theme/js/modules/blocklayered/blocklayered.js:


    /*if (typeof(current_friendly_url) === 'undefined')
    current_friendly_url = '#';
    $('div.pagination a').not(':hidden').each(function () {
    if ($(this).attr('href').search(/(\?|&)p=/) == -1)
    var page = 1;
    var page = parseInt($(this).attr('href').replace(/^.*(\?|&)p=(\d+).*$/, '$2'));
    var location = window.location.href.replace(/#.*$/, '');
    $(this).attr('href', location + current_friendly_url.replace(/\/page-(\d+)/, '') + '/page-' + page);
    and now category has proper url and $p domain, there's one more problem: 
    how to get variable of last page of the category? If there are 100 products spread across 10 category pages, how to check if page is the last one?
    Ok, I think I've managed to sort it out, JS changes the URL and $p variable only for user, not for google. Therefore $p variable can be safely used. With Javascript execution blocked, $p variable returned proper value depending on active site. Solution from this topic works well:
  4. Hello,


    I am trying to write a simple module that adds link rel=prev, next and canonical before </head> closing but I've encountered a problem with $p variable, which I found after using {debug} function.


    It says that $p value is always 1, no matter on which page of category I am, no matter if this is first main category or page nr 3 it always return value of 1. This stops me from checking the $p value condition.


    I've found that layered Layered navigation block v2.2.0 changes the address from:








    which caused the problem. When I manually enter mydomain.com/id-category-name?p=2 it says that $p = 2 correctly. When clicked on number 2 on the product page as usual (mydomain.com/id-category-name#/page-2) it says $p = 1 always.


    I would really appreciate possible solution with this, as it caused duplicate content issue and prevents our store from getting to the top positions of the search results.


  5. Hello,


    Is it possible to create login in PS 1.6 which works like it in PS 1.7? I mean, only one login type, not guest and create account separately, and depending if customer inserts password - if yes he has regular customer account which he can use later to place another order and if not he has a guest account?


    It works great in PS 1.7, definitely would help with returning customers, is there any override or a module which alters the way customers can register?


    Kind regards

  6. Hello,


    I am running prestashop on PHP 7.0.


    I want to create a module that will display usage calculator for some of products we sell. Is it possible to create a module that will add a page with name saved in module configuration, for eg.




    is it possible? If not, how to display php script on custom .tpl page?  


    That's a simple form with calculating products that customer needs depending on few variables (room size, etc). It works without any problem on localhost written in index.php. I would like to move the page within the PS store, how to make it have header and footer just like any other store page? I need it to add function, that will add calculated products to the cart in near future.


    I will appreciate any answer.

  7. This was actually fixed in PS 1.6 too. I tried to launch PS on php 7.1 and couldn't do anything - everytime 500 Internal server error, but after updating to store works with warnings only, that's why I asked, but it seems like it's not yet php 7.1 ready.



  8. Hello,


    I've seen a note in changelog:


    • PHP 7.1 Fatal error: operator not supported in DbQuery.php



    of latest prestashop version.

    I've updated my development store and installed php 7.1 on my server and can confirm that Fatal errors are gone, there are still few warnings (headers already sent) but the store works.

    Only thing that isn't working properly is payment page (I use 5-page checkout and advanced eu compliance module maybe that's the problem) completely broken, nothing is displayed.


    Besides this, most functions work, adding to cart, registering, cms pages, attributes and so on. 

    Just a few warnings and payment page is not bug-free.


    Does this mean prestashop is now officially compatible with php 7.1? 



  9. Hello, thanks for your answer, you are great.


    I am editing send to a friend module, to include current product info to e-mail, not just the message with link

    I've dealt with this by editing sendtoafriend_ajax.php file, I added:



    $product = new Product((int)$id_product, false, $module->context->language->id);

    $image = Product::getCover((int)$product->id);
    $current_price = round(Product::getPriceStatic((int)$product->id), 2, PHP_ROUND_HALF_UP);
    Thanks for your response, it was really helpful.
    Now I wonder how to add textbox to let customer pass his own message with this email, similar to order comment in checkout.
    If anybody knew the resolution I would be really grateful.
    Kind regards
  10. Hello,


    How to properly edit .htaccess for subdomain to make it allow connections only from specific ip addresses?


    when I add:


    Order Deny,Allow
    Deny from all
    Allow from xx.xxx.xxx.xx
    Allow from xx.xxx.xxx.xx
    only part of website is blocked.
    I have test site in:
    and it reads part of code from production store which is on:
    How do I make every resource loaded from www.mydomain.com be first redirected to sub.mydomain.com and then be checked for permissions?
    I think I should add condition which redirects no matter what, www or nonwww http or https to https://sub.mydomain.com
    This should also resolve problem with redirect chains. 
    I will appreciate any reply. 
  11. Hello,


    Just as in the title, I would like to add a module that will look like a language switch but will change the way prices are described. Simply to set all visible prices to tax included or without tax when pressed tax excluded. This would need to be saved in a cookie. Prices should only be displayed as with or without tax they should always be calculated with tax.


    Does the prestashop support this already or a new module needs to be created?


    I would appreciate any tip, many thanks.

  12. Hello,

    Is it possible to disable catalog discount globally for all attributes and all products? I want price reduction to be applied to base price, while it would have no impact to attribute cost. For example when base price is 100 and attribute impact 10 I want base price to be 80 and attribute 10 after %20 catalog discount. Perhaps prestashop doesnt support such option from back office, so I will probably need to make overrides for some files, anybody have idea where to start?

    Thank you

  13. I've noticed one thing today - condition works only on order step pages, for e.g. addresses or carriers. If I am a guest user on step 03. Adress button proceed to checkout leads to /order page like it should but after clicking on home page same button link to /order?login page


    With firebug I can see that isLogged = 0 and isGuest = 1, there's {if !$logged && !$is_guest} condition in blockcart.pl and the wrong button is still displayed. Even if customer is guest user there's still {if !$logged && !$is_guest} button {/if} visible. 


    Is there any options to force smarty to check condition before displaying part of .tpl file?


    Thank you.

  14. Unfortunately it didn't help. I tried to leave only {if !$logged} and created account to check if it works and suprisingly no. It looks like it's cached somewhere, not checked with every page refresh. That's odd because I used similar conditions on other parts of the site and they work without problems. Is there any way to force smarty to always check conditions for part of the code?


    Thanks for your help again. Appreciated.

  15. No, I added ?display_guest_checkout=1 to url by purpose to make customers see login and address fields after clicking proceed to checkout button. It works fine, on my site after clicking Proceed to checkout customer lands there but when he goes to see the product and then clicks proceed to checkout again there are login fields again.


    The problem I currently have is how to check if user has guest account and why conditions I used are not working.


    Thank you very much for your time

  16. Hello,


    Many thanks for your instruction, I partially solved my problem. However this link should be only present where the user is not logged and not guest. I added condition but it doesn't work:


    {if !$logged && ($isGuest == 0)} 
    <a class="btn btn-default button button-medium" href="{$link->getPageLink("authentication", true)|escape:'html'}?display_guest_checkout=1#order_step" title="{l s='Proceed to checkout' mod='blockcart'}" rel="nofollow">
    {l s='Proceed to checkout' mod='blockcart'}<i class="icon-chevron-right right"></i>
    <a class="btn btn-default button button-medium" href="{$link->getPageLink("$order_process", true)|escape:"html":"UTF-8"}" title="{l s='Proceed to checkout' mod='blockcart'}" rel="nofollow">
    {l s='Proceed to checkout' mod='blockcart'}<i class="icon-chevron-right right"></i>

    Any idea why it's not working?

  17. Hello,


    I would like to make customers who click on Proceed to checkout button in cart module to land on login page instead of summary. 


    How to make Proceed to checkout button redirect yoursite.com/order?step=1&display_guest_checkout=1 instead of yoursite.com/order ?


    Should I edit blockcart.tpl 


    <p id="cart-buttons">
    {if $order_process == 'order'}<a href="{$link->getPageLink("$order_process", true)|escape:'html'}" class="button_small" title="{l s='View my shopping cart' mod='blockcart'}" rel="nofollow">{l s='Cart' mod='blockcart'}</a>{/if}
    <a href="{$link->getPageLink("$order_process", true)|escape:'html'}" id="button_order_cart" class="exclusive{if $order_process == 'order-opc'}_large{/if}" title="{l s='Check out' mod='blockcart'}" rel="nofollow"><span></span>{l s='Check out' mod='blockcart'}</a>

    or rather order-steps.tpl ?


    <li class="{if $current_step=='summary'}step_current {elseif $current_step=='login'}step_done_last step_done{else}{if $current_step=='payment' || $current_step=='shipping' || $current_step=='address' || $current_step=='login'}step_done{else}step_todo{/if}{/if} first">
    {if $current_step=='payment' || $current_step=='shipping' || $current_step=='address' || $current_step=='login'}
    <a href="{$link->getPageLink('order', true)}">
    <em>01.</em> {l s='Summary'}
    <span><em>01.</em> {l s='Summary'}</span>
    <li class="{if $current_step=='login'}step_current{elseif $current_step=='address'}step_done step_done_last{else}{if $current_step=='payment' || $current_step=='shipping' || $current_step=='address'}step_done{else}step_todo{/if}{/if} second">
    {if $current_step=='payment' || $current_step=='shipping' || $current_step=='address'}
    <a href="{$link->getPageLink('order', true, NULL, "{$smarty.capture.url_back}&step=1&multi-shipping={$multi_shipping}")|escape:'html':'UTF-8'}">
    <em>02.</em> {l s='Login'}
    <span><em>02.</em> {l s='Login'}</span>

    Any tip will be greatly appreciated. 

  18. Hello again,


    We've updated our site a lot since the time I posted this topic and I would like to know your opinion again what is the first impression, product page and checkout/login on our site.

    The biggest changes recently are menu, cart and login functionality.


    Feel free to place some test orders, test logins, add address or alter it. 


    I will greatly update any feedback, impressions, what you don't like and what should be improved.



  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More