$cookie->customer_firstname and $cookie->customer_firstname always stay the same ! - Ecommerce x PrestaShop - PrestaShop

Jump to content

Photo

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

cookie session

#1

Posted 18 June 2013 - 03:41 AM

pedes

    PrestaShop Apprentice

  • Members
  • PipPip
  • 85 Active Posts
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.


#2

Posted 18 June 2013 - 08:10 AM

vekia

    PrestaShop Legend

  • Ambassadors
  • 50301 Active Posts
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, responsive prestashop modules MndfRK4.png


#3

Posted 18 June 2013 - 08:39 AM

pedes

    PrestaShop Apprentice

  • Members
  • PipPip
  • 85 Active Posts
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 ?

#4

Posted 18 June 2013 - 08:44 AM

vekia

    PrestaShop Legend

  • Ambassadors
  • 50301 Active Posts
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, responsive prestashop modules MndfRK4.png


#5

Posted 18 June 2013 - 08:51 AM

pedes

    PrestaShop Apprentice

  • Members
  • PipPip
  • 85 Active Posts
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 ?

#6

Posted 18 June 2013 - 09:26 AM

pedes

    PrestaShop Apprentice

  • Members
  • PipPip
  • 85 Active Posts
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 ?

#7

Posted 18 June 2013 - 09:30 AM

vekia

    PrestaShop Legend

  • Ambassadors
  • 50301 Active Posts
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, responsive prestashop modules MndfRK4.png


#8

Posted 18 June 2013 - 09:51 AM

pedes

    PrestaShop Apprentice

  • Members
  • PipPip
  • 85 Active Posts
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:

#9

Posted 01 July 2013 - 08:06 PM

cessargor

    PrestaShop Newbie

  • Members
  • Pip
  • 17 Active Posts
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?

#10

Posted 06 July 2013 - 01:30 PM

smartdatasoft

    PrestaShop Fanatic

  • Certified Partners
  • 1170 Active Posts
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-new.jpg
Managing your PrestaShop e-commerce has never been so easy with intuitive drag and drop interface with Backend and Frontend editors available out of the box.


#11

Posted 08 July 2013 - 08:27 AM

vekia

    PrestaShop Legend

  • Ambassadors
  • 50301 Active Posts
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, responsive prestashop modules MndfRK4.png


#12

Posted 08 July 2013 - 08:46 AM

smartdatasoft

    PrestaShop Fanatic

  • Certified Partners
  • 1170 Active Posts
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-new.jpg
Managing your PrestaShop e-commerce has never been so easy with intuitive drag and drop interface with Backend and Frontend editors available out of the box.


#13

Posted 08 July 2013 - 11:51 AM

vekia

    PrestaShop Legend

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

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


#14

Posted 08 July 2013 - 12:24 PM

smartdatasoft

    PrestaShop Fanatic

  • Certified Partners
  • 1170 Active Posts

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-new.jpg
Managing your PrestaShop e-commerce has never been so easy with intuitive drag and drop interface with Backend and Frontend editors available out of the box.


#15

Posted 08 July 2013 - 12:51 PM

lleonet2000

    PrestaShop Apprentice

  • Members
  • PipPip
  • 32 Active Posts
I have the same problem, but I don´t understand how to fix. Please can you explain more.

Sorry by my english.

#16

Posted 08 July 2013 - 03:03 PM

smartdatasoft

    PrestaShop Fanatic

  • Certified Partners
  • 1170 Active Posts

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-new.jpg
Managing your PrestaShop e-commerce has never been so easy with intuitive drag and drop interface with Backend and Frontend editors available out of the box.


#17

Posted 08 July 2013 - 03:54 PM

lleonet2000

    PrestaShop Apprentice

  • Members
  • PipPip
  • 32 Active Posts
Web was created by another person and I don't known if was developed by them.

Thanks for your response

#18

Posted 08 July 2013 - 05:28 PM

smartdatasoft

    PrestaShop Fanatic

  • Certified Partners
  • 1170 Active Posts
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-new.jpg
Managing your PrestaShop e-commerce has never been so easy with intuitive drag and drop interface with Backend and Frontend editors available out of the box.


#19

Posted 11 August 2013 - 11:07 PM

Silly2127

    PrestaShop Newbie

  • Members
  • Pip
  • 21 Active Posts
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.

#20

Posted 12 August 2013 - 04:54 PM

smartdatasoft

    PrestaShop Fanatic

  • Certified Partners
  • 1170 Active Posts
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-new.jpg
Managing your PrestaShop e-commerce has never been so easy with intuitive drag and drop interface with Backend and Frontend editors available out of the box.




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

Cookies help us deliver our services. By using our services, you agree to use our cookies.     Learn more