X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Parts of customer interface not showing!? (https://forum.x-cart.com/showthread.php?t=7227)

minorgod 04-20-2004 09:57 AM

Parts of customer interface not showing!?
 
I just started having a problem, where some customers come into my store and on any product page or cart page, the template labels are missing next to form fields. It seems like maybe it's my language variables that are not being substituted properly in the templates. All the product info is there, and the product review info shows up, but the labels for the product review form are missing, the "add to cart" label next to the go button and the "submit" button are all missing their info. I have tried to duplicate the problem on my machine with no success. I've tried in explorer and Mozilla. The customer has tried from his home and office computers with both Explorer (version 6.0.2800.1106.xpsp2...) and a new version of Mozilla. He sees broken pages everywhere. I cannot get it to happen on my machine. Could someone please check our store and see if they see any problems, or if you have a suggestion, I'd love to hear it. Here's the address...click on a product and let me know if you see any broken areas of the page.

http://www.realestate-school.com/online-store

here's a page that the customer said was broken:
http://www.realestate-school.com/online-store/customer/product.php?productid=98

blue-dreamer 04-20-2004 11:02 AM

I see what you mean, it's mssing for me (IE6/WinXP).

If you are sure all the language variables are there and in the templates try flushing out the templates cache (Admin>Administrators menu >Summary at the bottom of the page)

minorgod 04-20-2004 11:42 AM

Thanks for checking on it for me. I've already cleared my template cache...several times. Don't know what's up with this but it's apparently affecting many of our customers. I just can't find any problem with the templates....I haven't made any changes to the live pages in quite a while. I'm not seeing any problems on my machine using IE6 or Mozilla. Hmmmm.....could you maybe view the source and send me a copy of the HTML via e-mail? I think that's my only hope of being able to see what's going wrong.

You can e-mail me directly at brett@realestate-school.com.

blue-dreamer 04-20-2004 12:20 PM

You have mail!

minorgod 04-20-2004 01:16 PM

I think I have narrowed it down to a MySQL error. I found this in my error logs....
Quote:

[Tue Apr 20 15:12:15 2004] [error] PHP Warning: mysql_select_db(): A link to the server could not be established in /home/minorgod/public_html/online-store/include/func.php on line 10
[Tue Apr 20 15:12:15 2004] [error] PHP Warning: mysql_select_db(): Can't create a new thread (errno 12). If you are not out of available memory, you can consult the manual for a possible OS-dependent bug in /home/minorgod/public_html/online-store/include/func.php on line 10
[Tue Apr 20 15:12:15 2004] [error] PHP Warning: mysql_connect(): Can't create a new thread (errno 12). If you are not out of available memory, you can consult the manual for a possible OS-dependent bug in /home/minorgod/public_html/online-store/include/func.php on line 6


So maybe it's a server problem or due to an automatic MySQL upgrade at my web host. I'm looking into it now and will post my findings.

minorgod 04-21-2004 06:56 AM

Okay, so now I've discovered that the problem wasn't realated to the above errors. It turns out that for some reason the default store language was not being selected for users who had not already received a cookie to set their default language. I discovered this after I deleted all my browser cookies and then was finally able to reproduce the problem in my store. After running the pages in my remote debugger (PHPed rocks for this) I discovered that the /include/get_language.php file was the culprit. The problems seem to start on line 15 where it says
Code:

$customer_language = func_get_language ($store_language);
                if (!$customer_language]) {
                        $store_language = $config["default_customer_language"];
                        $customer_language = func_get_language ($store_language);
                }


It seems that the $customer language variable was returning a 1 element array with an empty key name and an empty string as the value. So in the next line it was skipping the default language assignment. I don't know why this just started happening, but I fixed it by changing the code to
Code:

$customer_language = func_get_language ($store_language);
                if (!$customer_language || empty($customer_language[0])) {
                        $store_language = $config["default_customer_language"];
                        $customer_language = func_get_language ($store_language);
                }

It's a dirty hack, but since I can't figure out why it broke in the first place I have no alternative but to use this hack.

minorgod 04-21-2004 07:14 AM

SUCCESS! I finally found the culprit. I had an empty language variable in my database and it was causing all the problems!!! So, let that be a lesson to you.

My code change above will protect your store from blank language variables in your database, at least in older versions. Since the new x-cart code often doesn't return arrays with a [0] element, it might not be so good for newer installations, but it will make your cart bulletproof from empty language variables in older carts.

blue-dreamer 04-21-2004 07:53 AM

Glad you got it sorted!


All times are GMT -8. The time now is 06:01 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.