Jump to content

Empty cart at refresh and login/logout problem of FO and BO delays ( cache problem i guess )


Recommended Posts

If i login and click disconnect , nothing happens , just a page refresh.
If i am logged in and go on Home Page , it doesn`t shows me i am logged in.After , i hit F5 and it shows that i am logged.
If i add a product to cart , it redirects me to card as it should but after, if i go to see other products it shows EMPTY CART. If i hit F5 it shows the correct cart. After i hit refresh it stays the same , correct cart.

On Back Office i have delays and new informations are showing only if i hit ctrl+f5 ( chrome ) 

On server was installed recently KeepAlive module - I don`t know if has something to do with this matter but i guess to share this.

If KeepAlive apache module is the problem , can someone tell me how to configure it to work with prestashop ? 

If needed i can give logins  ( to users that have strong history on this forum ) .

Problem is mentioned on forge also : http://forge.prestashop.com/browse/PSCFV-10881

http://fancumparaturi.ro/phpinfo.php - for php configuration.

Informații despre server
Informații despre server: Linux #1 SMP Tue Jul 16 23:51:20 UTC 2013 x86_64
Versiunea softului serverului: Apache
Versiunea PHP: 5.3.27
Limita memoriei: 1024M
Timpul maxim de execuție: 30
Informații despre baza de date
Versiune MySQL: 5.5.32-cll
Motor MySQL: InnoDB
Prefix tabele: ps_
Informații despre magazin
Versiune Prestashop: 1.5.6.0
URL magazin: http://fancumparaturi.ro/
Tema curentă folosită: go
Configurație e-mail
Metoda e-mail: Folosești proprii parametri SMTP.
Server SMTP: smtp.gmail.com
Utilizator SMTP: Definit
Parola SMTP: Definit
Criptarea: ssl
Port: 465

Parametrii obligatorii: OK
Parametrii opționali: OK

Link to comment
Share on other sites

Dev mode on : 

 

Errors in back office: 

 

Strict Standards: Declaration of Link::getModuleLink() should be compatible with that of LinkCore::getModuleLink() in /home/xsusors/public_html/override/classes/Link.php on line 10

Strict Standards: Declaration of Dispatcher::createUrl() should be compatible with that of DispatcherCore::createUrl() in /home/xsusors/public_html/override/classes/Dispatcher.php on line 10

 

 

Errors on index FRONT OFFICE : 

 

Strict Standards: Declaration of Link::getModuleLink() should be compatible with that of LinkCore::getModuleLink() in /home/xsusors/public_html/override/classes/Link.php on line 10

Strict Standards: Declaration of Dispatcher::createUrl() should be compatible with that of DispatcherCore::createUrl() in /home/xsusors/public_html/override/classes/Dispatcher.php on line 10

Warning: Cannot modify header information - headers already sent by (output started at /home/xsusors/public_html/override/classes/Link.php:10) in /home/xsusors/public_html/classes/controller/FrontController.php on line 751

Notice: Undefined variable: res2 in /home/xsusors/public_html/modules/googlesnippet/googlesnippet.php on line 265

Notice: Undefined variable: prices in /home/xsusors/public_html/modules/googlesnippet/googlesnippet.php on line 267

Link to comment
Share on other sites

@El Patron - Prestashop Fanatic - I am saying this because you know why ! I wounder if have used the same "bump" when u needed some help from the community when u were starting with Prestashop. I have a live shop with about 20 orders / day , so please , understand that i am pretty desperate right now.

  

   Now , if u still want to help me , even if i said bump about 5 times , i have set the URLs like this : 

 

   Shop URL : fancumparaturi.ro

   SSL domain : fancumparaturi.ro

   Base URL : /

 

  Thank you ! And , sorry for so many buumps.

Link to comment
Share on other sites

I observed that maybe it is a smarty issue cause , on Back Office , if i have a new order , the js is updating , i mean , the little icon from top with new order is updating , but on order list , new orders appear only if i hit F5. Also on order page ( OPC ) , js is working , if u setup a new account js is loading correctly. 

Just mentioning that the website is the one from my signature.

Link to comment
Share on other sites

Hi Larry Baldwin,

 

There may be some reasons for happing this problem.

1.)  If browser is not accept cookie [this is not in your case, because you told problem with a module]

2.) Conflickting cookie already exist in browser [also not applicable]

3.) Front-office Context cookie is empty any how or not store Customer info or any others.

 

I think number 3 is applicabale, as you problem with the certail module.

 

Notice: Undefined variable: res2 in /home/xsusors/public_html/modules/googlesnippet/googlesnippet.php on line 265

Notice: Undefined variable: prices in /home/xsusors/public_html/modules/googlesnippet/googlesnippet.php on line 267

Go to that file try to declare $es2 & $prices ;  assign default value null. Also try to find out why $res2 is undefined.

 

If you can show full source codes of that file I can help you much. May you can use pastebin

 

Thanks

Link to comment
Share on other sites

Code for ../modules/googlesnippet/googlesnippet.php :

 

<?php
ini_set('allow_url_fopen',true);
class GoogleSnippet extends Module
{
 
private $_html = '';
 
private $_postErrors = array();
 
function __construct()
{
$this->name = 'googlesnippet';
if(_PS_VERSION_ > "1.4.0.0" && _PS_VERSION_ < "1.5.0.0"){
$this->tab = 'administration';
$this->author = 'RSI';
$this->need_instance = 0;
}
elseif(_PS_VERSION_ > "1.5.0.0"){
$this->tab = 'administration';
$this->author = 'RSI';
}
 
else{
$this->tab = 'Tools';
}
$this->version = '1.2';
 
parent::__construct();
 
$this->displayName = $this->l('Google Rich Snippet');
$this->description = $this->l('Add google snippet to your site - www.catalogo-onlinersi.com.ar');
 
 
 
}
 
function install()
{
global $fh;
if (!Configuration::updateValue('GOOGLESNIPPET_NBR', 'https://plus.google.com/118067945609961636215/posts') OR !parent::install() OR !$this->registerHook('header') /* OR !$this->registerHook('extraLeft')*/)
return false;
 
@chmod(_PS_THEME_DIR_."product.tpl", 0777 ); 
$str = "";
 
if($fh = fopen(_PS_THEME_DIR_.'product.tpl', 'r')){
while(!feof($fh)){
$str .= fgets ($fh);
}
$str = str_replace('<div id="primary_block" class="clearfix">','<article itemscope itemtype="http://schema.org/Product"><div id="primary_block" class="clearfix">', $str);
$str = str_replace('id="bigpic"','id="bigpic" itemprop="image"', $str);
$str = str_replace('<h1>','<h1 itemprop="name">', $str);
$str = str_replace('<h2>{$product->name|escape:\'htmlall\':\'UTF-8\'}</h2>','<h2 itemprop="name">{$product->name|escape:\'htmlall\':\'UTF-8\'}</h2>', $str);
 
 
$str = str_replace('id="short_description_content"','id="short_description_content" itemprop="description"', $str);
$str = str_replace('id="short_description_block"','id="short_description_block" itemprop="description"', $str);
 
$str = str_replace('class="editable"','class="editable" itemprop="sku"', $str);
$str = str_replace('id="availability_value"','id="availability_value" itemprop="availability"', $str);
$str = str_replace('id="our_price_display"','id="our_price_display" itemprop="price"', $str);
$str = str_replace('id="buy_block"','id="buy_block" itemprop="offers" itemscope itemtype="http://schema.org/Offer"' $str);
fclose($fh);
@chmod(_PS_THEME_DIR_."product.tpl", 0644 ); 
$x42 = fopen (_PS_THEME_DIR_.'product.tpl', "w");
    fwrite ($x42,$str);
else {
die ("Error opening file in ".__FILE__." on line ".__LINE.".");
}
return true;
 
}
public function uninstall()
{
if (parent::uninstall() == false)
return false;
chmod("../themes/"._THEME_NAME_."/product.tpl", 0777 ); 
$str = "";
 
if($fh = fopen('../themes/'._THEME_NAME_.'/product.tpl', 'r')){
while(!feof($fh)){
$str .= fgets ($fh);
}
$str = str_replace('<article itemscope itemtype="http://schema.org/Product"><div id="primary_block" class="clearfix">','<div id="primary_block" class="clearfix">', $str);
$str = str_replace('id="bigpic" itemprop="image"','id="bigpic"', $str);
$str = str_replace('<h1 itemprop="name">','<h1>', $str);
$str = str_replace('id="short_description_content" itemprop="description"','id="short_description_content"', $str);
$str = str_replace('id="short_description_block" itemprop="description"','id="short_description_block"', $str);
 
$str = str_replace('class="editable" itemprop="sku"','class="editable"', $str);
$str = str_replace('id="availability_value" itemprop="availability"','id="availability_value"', $str);
$str = str_replace('id="our_price_display" itemprop="price"','id="our_price_display"', $str);
$str = str_replace('id="buy_block" itemprop="offers" itemscope itemtype="http://schema.org/Offer",id="buy_block"' $str);
fclose($fh);
 
 
 
@chmod("../themes/"._THEME_NAME_."/product.tpl", 0644 ); 
$x42 = fopen (_PS_THEME_DIR_.'product.tpl', "w");
    fwrite ($x42,$str);
else {
die ("Error opening file in ".__FILE__." on line ".__LINE.".");
}
return true;
 
}
 
public function postProcess()
{
global $currentIndex;
 
$errors = false;
 
if ($errors)
echo $this->displayError($errors);
}
 
  
  
 
 
 
public function displayForm()
{
 
  global $cookie;
  
   
 
  $defaultLanguage = intval(Configuration::get('PS_LANG_DEFAULT'));
$languages = Language::getLanguages();
$iso = Language::getIsoById($defaultLanguage);
$divLangName = 'link_label';
/*print _PS_THEME_DIR_."/contact-form.tpl";*/
    $this->_html .= '
 
    
      <form action="'.$_SERVER['REQUEST_URI'].'" method="post" id="form">
 
<fieldset><legend><img src="'.$this->_path.'logo.gif" alt="" title="" />'.$this->l('Settings').'</legend>
<p>'.$this->l('Test your product page here: http://www.google.com/webmasters/tools/richsnippets').'</p>
 
<input type="text" size="100" name="nbr" value="'.Tools::getValue('nbr', Configuration::get('GOOGLESNIPPET_NBR')).'" />
<p>'.$this->l('Put your google plus profile like : https://plus.google.com/118067945609961636215/posts').'</p>
<center><input type="submit" name="submitGoogleSnippet" value="'.$this->l('Save').'" class="button" /></center><br/>
 
  <center><a href="../modules/googlesnippet/moduleinstall.pdf">README</a></center><br/>
<center><a href="../modules/googlesnippet/termsandconditions.pdf">TERMS</a></center><br/>
  </form>
    </fieldset>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<fieldset><legend><img src="'.$this->_path.'logo.gif" alt="" title="" />'.$this->l('Contribute').'</legend>
<p class="clear">'.$this->l('You can contribute with a donation if our free modules and themes are usefull for you. Clic on the link and support us!').'</p>
<p class="clear">'.$this->l('For more modules & themes visit: www.catalogo-onlinersi.com.ar').'</p>
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="HMBZNQAHN9UMJ">
<input type="image" src="https://www.paypalobjects.com/WEBSCR-640-20110401-1/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/WEBSCR-640-20110401-1/en_US/i/scr/pixel.gif" width="1" height="1">
</fieldset>
</form>';
  
 
  
  
 
 
 return $this->_html;
}
 
public function getContent()
{
 
$this->postProcess();
global $cookie,$currentIndex;
 
if (Tools::isSubmit('submitGoogleSnippet'))
{
$nbr = Tools::getValue('nbr');
$text = Tools::getValue('text');
Configuration::updateValue('GOOGLESNIPPET_NBR', $nbr);
Configuration::updateValue('GOOGLESNIPPET_TEXT', $text);
 
$this->_html .= @$errors == '' ? $this->displayConfirmation('Settings updated successfully') : @$errors;
 
 
}
 
return $this->displayForm();
 
}
 
function hookExtraLeft($params)
{
 
return $this->display(__FILE__, 'googlesnippet-footer.tpl');
}
public function getProductscath($id_product)
{
$result = Db::getInstance()->getRow('
 
SELECT COUNT(pc.`grade`) AS totalCount
 
FROM '._DB_PREFIX_.'product_comment pc 
WHERE pc.id_product = '.$id_product.'');
 
return $result['totalCount'];
 
 
}
public function getProductscathsum($id_product)
{
$result = Db::getInstance()->getRow('
 
SELECT SUM(pc.`grade`) AS totalCount
 
FROM '._DB_PREFIX_.'product_comment pc 
WHERE pc.id_product = '.$id_product.'');
 
return $result['totalCount'];
 
 
}
public function getPages($objidvideo)
{
 
 
 
$result =  Db::getInstance()->ExecuteS('
SELECT pt.`id_page_type`,pt.`name`,p.`id_page_type`,p.`id_page`,p.`id_object`  
FROM `'._DB_PREFIX_.'page` p
LEFT JOIN `'._DB_PREFIX_.'page_type` pt ON p.`id_page_type` = pt.`id_page_type`
WHERE p.`id_page` = '.$objidvideo.' LIMIT 1');
 
 
 
 
 
return ($result);
}
function hookHeader($params)
{
 
global $smarty, $psversion, $res;
 
$objidvideo=Page::getCurrentId();
$objres = $this->getPages($objidvideo);
foreach ($objres as $obre)
{
 
$idnamev = $obre['name'];
 
}
$plusname = Configuration::get('GOOGLESNIPPET_NBR');
if($idnamev == "product" || $idnamev == "product.php"){
$id_product = intval(Tools::getValue('id_product'));
$prices = Product::getPriceStatic($id_product);
$res = GoogleSnippet::getProductscath($id_product);
@$res2 = round(GoogleSnippet::getProductscathsum($id_product)/$res,0);
}
$psversion = _PS_VERSION_;
$smarty->assign(array( 'psversion' => $psversion));
$smarty->assign(array( 'res' => $res));
$smarty->assign(array( 'res2' => $res2));
$smarty->assign(array( 'plusname' => $plusname));
$smarty->assign(array( 'prices' => $prices));
 
if(_PS_VERSION_ > "1.5.0.0")
{
//return $this->display(__FILE__, 'googlesnippet-header.tpl');
}
if(_PS_VERSION_ < "1.5.0.0" && _PS_VERSION_ > "1.4.0.0")
{
// return $this->display(__FILE__, 'googlesnippet-header2.tpl');
 
}
if(_PS_VERSION_ < "1.4.0.0")
{
// return $this->display(__FILE__, 'googlesnippet-header3.tpl');
 
}
}
 
 
 
 
 
}
?>
Link to comment
Share on other sites

Also i got a reply from hosting that is trying to help me find the problem : 

 

They are saying that i have mod_expires in htacces ,and maybe that is the problem. They are not prestashop experts , they just trying to help. The directive they are refering to : 

 

 

<IfModule mod_expires.c>

 ExpiresActive On

 ExpiresByType image/gif "access plus 1 month"

 ExpiresByType image/jpeg "access plus 1 month"

 ExpiresByType image/png "access plus 1 month"

 ExpiresByType text/css "access plus 1 week"

 ExpiresByType text/javascript "access plus 1 week"

 ExpiresByType application/javascript "access plus 1 week"

 ExpiresByType application/x-javascript "access plus 1 week"

 ExpiresByType image/x-icon "access plus 1 year"

</IfModule>

Link to comment
Share on other sites

Hi Larry Baldwin

I have found one serous error for now (may be more errors)

@ line 62 : $str = str_replace('id="buy_block"','id="buy_block" itemprop="offers" itemscope itemtype="http://schema.org/Offer"' $str);

please replace with $str = str_replace('id="buy_block"','id="buy_block" itemprop="offers" itemscope itemtype="http://schema.org/Offer"',$str);

 

------------------

I am confused about the url

@line 40 : Configuration::updateValue('GOOGLESNIPPET_NBR', 'https://plus.google....961636215/posts')

please make "https://plus.google....961636215/posts" is correct. FYI there is no .com or others.

 

Let me know the problem is not solved yet.

Link to comment
Share on other sites

Dev mode on :

 

Notice: Undefined variable: res2 in /home/xsusors/public_html/modules/googlesnippet/googlesnippet.php on line 265

Notice: Undefined variable: prices in /home/xsusors/public_html/modules/googlesnippet/googlesnippet.php on line 267

 

 

Made the changes u mentioned above and with DEV MOD on that was what i was getting.

Link to comment
Share on other sites

0.) Uninstall the module.

1.) Disable Cache

2.) Check Force compilation [AP -> Performence]

3.) Goto template directory & check product.tpl [it may be empty]; replace original one with write permission.

4.) Install module

-----------------------------------

Make sure you submit a valid Google+ profile url

 

Let me know, I will fix

Edited by Mohammad Nazrul (see edit history)
Link to comment
Share on other sites

I have made a backup of product.tpl

I have deactivated and uninstalled the module. Cleared cache/smarty , and force compiled. 

All working at first sight on Front Office.

On Back office , works only with CTRL+F5.

 

Dev mode on , only on product page appears this : 

 

Warning: Function getCurrent() is deprecated in /home/xsusors/public_html/modules/piwik/piwik.php on line 281
in /home/xsusors/public_html/classes/Tools.php on line 1961

 

Product TPL is not empty - Checked.

 

 

Goto template directory & check product.tpl [it may be empty]; replace original one with write permission.

 

I don`t understand this, sorry :( 

I need to upload original theme product.tpl over the existing one ? 

Link to comment
Share on other sites

I cleared cache/cookies , tried with 3 different browsers to change order status from Preparation in progress to canceled. Status changed but appeared only after i hit CTRL+F5.

On front office i have logged in , all good , clicked disconnect and nothing hapened even if the page has reloaded. Clicked again that awesome CTRL+F5 , appeared as logged out.

Link to comment
Share on other sites

  • 2 weeks later...

Hi!

Do you have a wordpress installation with W3 Total Cache plugin in the root of the domain?

 

I have the same problem, I have a website with Wordpress and W3 Total Cache in the root domain, and Prestashop installed in a subfolder, and if I disable the W3 Total Cache, Prestashop login/logout works fine.

Link to comment
Share on other sites

  • 1 year later...
×
×
  • Create New...