Vote to Improve PrestaShop

PrestaShop Forum: Build a free online shop. Count on the Community!

The best place in the world to ask questions about PrestaShop and get advice from our passionate community!

PrestaShop Forum: Build a free online shop. Count on the Community!

Jump to content

 
Photo

$cookie->customer_firstname and $cookie->customer_firstname always stay the same !

cookie session

  • Please log in to reply
21 replies to this topic
pedes

    PrestaShop Apprentice

  • Members
  • PipPip
  • 71 posts

Posted 18 June 2013 - 03:41 AM

if a customer logged in his/her name is visible at the top of the header (user info).
this first and last name should be the name of the logged customer, but for one or another reason this always stay the same.
The last name since the cache was empty before.

The first and last name are stored in a cookie, like:
{$cookie->customer_firstname} {$cookie->customer_lastname}

but it seems that this is no getting empty after ending the customers session.

Anyone has a clue how to fix this ?

Many thanks !

I'm using Prestashop v1.5.4.1, it was an upgrade from v1.4.8.

Edited by pedes, 18 June 2013 - 04:22 AM.


vekia

    PrestaShop Legend

  • US Moderators
  • 46628 posts

Posted 18 June 2013 - 08:10 AM

since the 1.5.x version of prestashop you should use $context object instead the $cookie
maybe try with $context

free tutorials, free templates, free addons, prestashop modules MndfRK4.png


pedes

    PrestaShop Apprentice

  • Members
  • PipPip
  • 71 posts

Posted 18 June 2013 - 08:39 AM

hi vekia, thank you for your reply.

I changed like you said:
{$cookie>customer_firstname} {$cookie->customer_lastname}
to
{$context->customer_firstname} {$context->customer_lastname}

but this is not working ... i have no names coming at all.

Any other suggestions ?

vekia

    PrestaShop Legend

  • US Moderators
  • 46628 posts

Posted 18 June 2013 - 08:44 AM

bu you've got defined it somewhere in the PHP ? (the context object)

moreover, you use variable which isn't exist: {$context->customer_firstname}


check this documentation: http://doc.prestasho...cesstheContext?

free tutorials, free templates, free addons, prestashop modules MndfRK4.png


pedes

    PrestaShop Apprentice

  • Members
  • PipPip
  • 71 posts

Posted 18 June 2013 - 08:51 AM

I have just checked the code in the fresh down loaded v1.5.4.1 and there they also use
{$cookie->customer_firstname} {$cookie->customer_lastname}

so it would be normal to use the $cookie tag.

But something els has to be wrong ... but what ?

pedes

    PrestaShop Apprentice

  • Members
  • PipPip
  • 71 posts

Posted 18 June 2013 - 09:26 AM

if i turn off the cache in the advanced parameters tab it is working like it should be !

but how can i let it work with the cache turned on ?

vekia

    PrestaShop Legend

  • US Moderators
  • 46628 posts

Posted 18 June 2013 - 09:30 AM

okay i checked sources, you've got right.
it's really weird :/

it looks like cache issue.

have you got possibility to use mod_expires ? check this:

Well, here's the solution that worked for me.

1) via FTP find .htaccess file
2) edit it with Notepad and find the part with "<IfModule mod_expires.c>"
3) delete his content and add "ExpiresActive Off"

The resulting content should be

<IfModule mod_expires.c>
ExpiresActive Off

</IfModule>


from thread: http://www.prestasho..._1#entry1271900

free tutorials, free templates, free addons, prestashop modules MndfRK4.png


pedes

    PrestaShop Apprentice

  • Members
  • PipPip
  • 71 posts

Posted 18 June 2013 - 09:51 AM

thanks for the reply ..

I have no succes on this ..
even with the .htaccess modification
<IfModule mod_expires.c>
ExpiresActive Off
</IfModule>

this is still not working :unsure:

cessargor

    PrestaShop Newbie

  • Members
  • Pip
  • 17 posts

Posted 01 July 2013 - 08:06 PM

hello, we have same issue with the last 4 prestashop sites we have been working, my clients are about to cancell my projects as i dont have any idea how to make the right logging name to appear, it is for sure a CACHE module issue, all works fine when you have cache disable or if you clean cache using a free module like this http://www.prestatoo...prestashop.html , the problem is that you have to flush cache every day (which is not really a solution).

i have post the bug to prestashop forums (not answer yet).

maybe if we tell the cache to NOT cache the welcome module? anyone know how to make that happen? adding a line to avoid caching for that module only?

smartdatasoft

    PrestaShop Addict

  • Certified Partners
  • 882 posts

Posted 06 July 2013 - 01:30 PM

Hello, cessargor
I have notice this today when you have send mail to the support. This is happen due to some theme developer separate the my account content to other module. but the my account module add some smarty variable from php for that cookie value changed when login.
ps-signature.jpg
developed by smartdatasoft, Prestashop certified web agency

vekia

    PrestaShop Legend

  • US Moderators
  • 46628 posts

Posted 08 July 2013 - 08:27 AM

hello

im really interested in this case, smartdatasoft, can you please give a bit more info here?
any example of the code?

free tutorials, free templates, free addons, prestashop modules MndfRK4.png


smartdatasoft

    PrestaShop Addict

  • Certified Partners
  • 882 posts

Posted 08 July 2013 - 08:46 AM

The things is that. Our old developer cut code of customer login information from blockuserinfo
{if $logged}
			 <li>  <a href="{$link->getPageLink('index', true, NULL, "mylogout")}" title="{l s='Log me out' mod='blockcurrencies'}">{$cookie->customer_lastname} ({l s='Log out' mod='blocksearch'})</a></li>
		{else}
  
			<li {if $page_name == 'authentication'} class="highlight" {/if} ><a href="{$link->getPageLink('my-account', true)}">{l s='Login'  mod='blocksearch'}</a></li>
		{/if}

and put to blocksearch for design match. In design the login information link is on top and cart information is side to menu.

But in blockuserinfo the bellow value is assigned in tpl
$this->smarty->assign(array(
   'cart' => $this->context->cart,
   'cart_qties' => $this->context->cart->nbProducts(),
   'logged' => $this->context->customer->isLogged(),
   'customerName' => ($this->context->customer->logged ? $this->context->customer->firstname.' '.$this->context->customer->lastname : false),
   'firstName' => ($this->context->customer->logged ? $this->context->customer->firstname : false),
   'lastName' => ($this->context->customer->logged ? $this->context->customer->lastname : false),
   'order_process' => Configuration::get('PS_ORDER_PROCESS_TYPE') ? 'order-opc' : 'order'
  ));

If the site is cached the value also change customer login information to to the firstName and lastName is changed by the tpl. If the tpl code of blockuserinfo is shifted to other module then the customer login name is correct only when cache is disable. If cache is enable then the login name show last login customer name which is bug.

So the blockuserinfo and block cart need to put same ui place. Do you need any more information vekia :)

Edited by smartdatasoft, 08 July 2013 - 08:46 AM.

ps-signature.jpg
developed by smartdatasoft, Prestashop certified web agency

vekia

    PrestaShop Legend

  • US Moderators
  • 46628 posts

Posted 08 July 2013 - 11:51 AM

yeah! nope all is clear now, many thanks to you smartdatasoft, seems like the issue is solved ;D

free tutorials, free templates, free addons, prestashop modules MndfRK4.png


smartdatasoft

    PrestaShop Addict

  • Certified Partners
  • 882 posts

Posted 08 July 2013 - 12:24 PM

yeah! nope all is clear now, many thanks to you smartdatasoft, seems like the issue is solved ;D

vekia can you told one things. Although the veriable is not use on blockuserinfo.tpl which pass from the php page. How the customer name change when cache is enable.
and this value give wrong information when move to other tpl :)
{$cookie->customer_lastname}

ps-signature.jpg
developed by smartdatasoft, Prestashop certified web agency

lleonet2000

    PrestaShop Apprentice

  • Members
  • PipPip
  • 32 posts

Posted 08 July 2013 - 12:51 PM

I have the same problem, but I don´t understand how to fix. Please can you explain more.

Sorry by my english.

smartdatasoft

    PrestaShop Addict

  • Certified Partners
  • 882 posts

Posted 08 July 2013 - 03:03 PM

I have the same problem, but I don´t understand how to fix. Please can you explain more.

Sorry by my english.

are you using the leisure theme developed by smartdatasoft if so then mail with your site url to support[.]smartdatsoft[.]com we will give further instruction of file to your to fix that.
ps-signature.jpg
developed by smartdatasoft, Prestashop certified web agency

lleonet2000

    PrestaShop Apprentice

  • Members
  • PipPip
  • 32 posts

Posted 08 July 2013 - 03:54 PM

Web was created by another person and I don't known if was developed by them.

Thanks for your response

smartdatasoft

    PrestaShop Addict

  • Certified Partners
  • 882 posts

Posted 08 July 2013 - 05:28 PM

You can send me the url or take a look it like this site.http://smartdatasoft.com/prestashop/leisure/fashion-shop if it like this site than the them was build by our team
ps-signature.jpg
developed by smartdatasoft, Prestashop certified web agency

Silly2127

    PrestaShop Newbie

  • Members
  • Pip
  • 21 posts

Posted 11 August 2013 - 11:07 PM

Hello everyone,

I have encountered the same issue and I am trying to follow along what everyone is saying, but I am completely lost. I am so frustrated because we just launched our site one week ago and it is embarrasing. If anyone can give me a hand, I would be so thankful. My site is www.shopusa.cl.

Best regards.

smartdatasoft

    PrestaShop Addict

  • Certified Partners
  • 882 posts

Posted 12 August 2013 - 04:54 PM

Hello,Silly2127,
i replied your personal message. and you notice that i also wrote above that some code are inside the php code which change the blockcart.tpl's user information. so we need to put theme also in the theme module. which some theme developer do not know
ps-signature.jpg
developed by smartdatasoft, Prestashop certified web agency





Also tagged with one or more of these keywords: cookie session

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users