Jump to content

Gerard

Members
  • Posts

    5
  • Joined

  • Last visited

Profile Information

  • Location
    Barcelona

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Gerard's Achievements

Newbie

Newbie (1/14)

0

Reputation

1

Community Answers

  1. Hi all, I'll do a promotion on the site, then I created a landing page with his own controller, I modified the ProductController to check if the ID of the product it's new that you only can access through the landing, then, when you access the product, I created on controller a cookie that only permit buy the product if you put a correct VAT number on the checkout form. The problem comes when for example deletes from the cart the product. Then I created a conditional in JS that checks the ID of the product and if it's the promotional product I execute an AJAX that calls a .php for destroy the cookie that doesn't let you buy if you don't put the VAT number. To make it more schematic: A user of the promotion (Company) lands on the landing page The user clicks on the product, then is redirected to the product page with a parameter in the URL to confirm that it comes from the promo. The user adds the product to the cart and he goes to the checkout. We create the cookie of the promo. If the cookie of the promo exists, then, the user needs to fill the VAT Number field mandatory. When the user buys the product or removes the product from the summary of the cart, that cookie needs to be removed so that the user can buy other products without having to enter the VAT number Since only this product will be valid for B2B, if you delete this product, the rest can be purchased without entering a VAT number. I set the cookie like this: $_SESSION['promotion']="promotional-product"; $cookie= new Cookie('promotion'); $cookie->setExpire(time() + 45 * 60); $cookie->variable_name = 'promotional-product'; $cookie->write(); And to get the cookie on the destroy file I have the following: <?php include_once('./config/config.inc.php'); include_once('./config/settings.inc.php'); include_once('./classes/Cookie.php'); //to read $cookie = new Cookie('promotion'); //echo $cookie->variable_name; if (isset($_COOKIE[$cookie->variable_name])) { setcookie($cookie->variable_name, null, -1, '/'); unset($_COOKIE[$cookie->variable_name]); } If I access to destroy PHP file with the "echo" I see the name of the cookie correctly, so far so good, I get to read the cookie or maybe not, it's the first time that I do that. And the AJAX that calls the destroy.php it's the following /*...*/ var id2 = id.substr(0,2); $('#product_' + id).fadeOut('slow', function() { if(id2 == 21) { $.ajax({ type: "GET", url: 'destroy.php', success: function(data){ console.log("Done"); } }); } $(this).remove(); ... When I delete the product 21 from the cart I got the message "Done" in console correctly. Now the issue is on Smarty, I can't get the cookie name, I have the following: {if $cookie->promotion=='promotional-product'} And below that, the HTML. I tried with: {$smarty.cookies.promotion} and {$smarty.cookies.promotional-product} just for curiosity and test if can get something, with the first I see nothing and with the second I see a number 0. Could you help me with that? Would I have to create the cookie differently for Smarty to read it? Is there any other way to do this? Many thanks in advance!
  2. Hi El Patron, we solved the problem. I marked my answer on the top, how Ii can close the thread and set "Solved" on the title? Many thanks
  3. Hi guys, finally it's solved. The problem was a cookie on the country selection page and prestashop was searching the tax based on browser language. It was hard to find the problem Many thanks for help!!
  4. Hi El Patron, thanks for the help, but unfortunately seems that's not the problem, I disabled all cache types and sometimes still occurring. But it's very strange because, for example, I see the price correct with incognito mode, but another colleague doesn't see the correct prices or maybe he sees the prices correctly on his pc but not in his mobile... We are testing always in incognito mode.
  5. Hi all, I have a problem with my site, sometimes when you load the site for the first time, the site is showing prices without taxes but when you refresh for the second time, the prices show correctly. It's very strange, I have the site with 17 countries created with multi-store but now only have 3 countries published. The main country on "All shops" is the UK but on this site this problem it's not happening, only on Netherlands and Germany, respectively of individual form, each country their default country assigned, I mean, Germany has Germany and Netherlands has Netherlands on "Localization > Localization > Default country". I've checked taxes, tax rules, cache, disabled smarty cache, enabled, force compilation, manual cache removing, etc. But this seems to keep occurring. The most strange thing on this is that I checked with Opera with VPN from Netherlands, I changed my computer language and occurs randomly. Sometimes when I access the site with my computer I see the prices correctly, sometimes I see the prices wrong. Regards and thanks in advance
×
×
  • Create New...

Important Information

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