Jump to content



Photo
- - - - -

Sessions, languages and ajax loading


  • Please log in to reply
26 replies to this topic

#21   piernas

piernas
  • Members
  • 456 posts
  • Real Name:Juanma
  • Gender:Male
  • Location:Madrid

Posted 06 February 2017 - 13:34

@burt It also happens on an old 2.2 shop:

  ["cart"]=>
  &object(shoppingCart)#1 (5) {
    ["contents"]=>
    array(0) {
    }
    ["total"]=>
    float(55)
    ["weight"]=>
    float(1.5)
    ["cartID"]=>
    string(5) "22143"
    ["content_type"]=>
    bool(false)


#22   wHiTeHaT

wHiTeHaT
  • Community Team
  • 1,113 posts
  • Real Name:Henry
  • Gender:Male
  • Location:Netherlands

Posted 06 February 2017 - 18:36

I remembered i seen it before in the oscom 3 class

function remove:

https://github.com/o...g_cart.php#L437

 

And right below function calculate:

https://github.com/o...g_cart.php#L456


Do you need an osCommerce website? Do you want to have an Responsive osCommerce CONTACT ME as i am for HIRE

#23   burt

burt

    I drink and I know things

  • Community Team
  • 12,307 posts
  • Real Name:G Burton
  • Gender:Male
  • Location:UK/DEV/on

Posted 07 February 2017 - 09:35

@piernas ok...

What I'm saying is that I cannot recreate it.  The weight and total both go to zero on removing product from cart.


This is a signature that appears on all my posts.  It is not specifically aimed at you.

 

IF YOU MAKE A POST REQUESTING HELP...please state the exact version of osCommerce that you are using. THANKS
 
If you are still on the old style osCommerce, it is time to move to Responsive.

 


#24   wHiTeHaT

wHiTeHaT
  • Community Team
  • 1,113 posts
  • Real Name:Henry
  • Gender:Male
  • Location:Netherlands

Posted 07 February 2017 - 10:47

Tested on :

live server php7 (unix),

local server php7 & php 5.6.19 (Windows/Wamp).

i can confirm piernas is right.

 

Still i assume it have to do with server settings.

There is nowhere in the shopping_cart.php class told to unset these 2 vars, when remove product. i am more surprised Gary's testing result.


Edited by wHiTeHaT, 07 February 2017 - 10:56.

Do you need an osCommerce website? Do you want to have an Responsive osCommerce CONTACT ME as i am for HIRE

#25   piernas

piernas
  • Members
  • 456 posts
  • Real Name:Juanma
  • Gender:Male
  • Location:Madrid

Posted 07 February 2017 - 12:24

I've tested on wamp/php 5.6.28/oscommerce 2.3.4 and linux/php 5.3.29/oscommerce 2.2 but as @wHiTeHaT says it's strange as the cart variables aren't updated at that point.



#26   Gergely

Gergely

    Json Juggler

  • Community Team
  • 2,102 posts
  • Real Name:Gergely Tóth
  • Gender:Male
  • Location:Budapest

Posted 08 February 2017 - 21:16

I made an external file that updates the shopping cart without a page reload. It reloads application_top and the needed navbar module and cart totals and replaces the corresponding divs.

 

It works well in every aspect but one: The dummy page loads correctly the session id and cart, but it refreshes the language and takes the default one. I can force to change the language but I don't understand why it keeps the other parameters but changes the language and language_id.

 

Any idea of why it happens?


The problem is the component loading sequencies.

First you load application_top.php where languages and anithing else defined...

Use osCsid when call ajax modules.

Url: mydomain/ajax.php?osCsid=orig&language=current_language

 


Next PHP changes will kill the current codes on the following years. We should do programing for the future and never stick in the present.

My addons: Conversion Tools::Hungarian Translation::Email Templates::URL redirection
 
Development Works: Setup Languages::Email Templates::Languages from ini files::Parcel Shops::Facebook App
 
What core codes have been complained?

In orders table payment_methods value would be better if payment class name used than payment's language name.
In the orders class we found order status does not contains $order->info['orders_status'] but instead there is $order->info['orders_status_name'], and that property is language dependant.
We can not identify in order the customer language.


#27   greasemonkey

greasemonkey
  • Members
  • 1,006 posts
  • Real Name:Scott
  • Gender:Male

Posted 09 February 2017 - 20:31

I made an external file that updates the shopping cart without a page reload. It reloads application_top and the needed navbar module and cart totals and replaces the corresponding divs.

 

It works well in every aspect but one: The dummy page loads correctly the session id and cart, but it refreshes the language and takes the default one. I can force to change the language but I don't understand why it keeps the other parameters but changes the language and language_id.

 

Any idea of why it happens?

 

Any chance to see what you have built? I have been trying (without success) to use one of the "old" add to cart/buy now ajax mods  - and then was going to try and get my shopping cart navbar dropdown div to pop open "on event" (clicking the add to cart). In a similar, but less obtrusive way, to the add to cart modal.