Page 1 of 1

Shopping Cart not showing

Posted: Sat May 18, 2024 8:34 pm
by Xpajun
After clicking checkout on product_info.php I get a blank page for shopping_cart.php

Errors are :

Code: Select all

[18-May-2024 20:14:16 UTC] PHP Fatal error:  Uncaught TypeError: array_filter(): Argument #1 ($array) must be of type array, null given in /home/******/public_html/store/includes/system/versioned/1.0.5.1/customer.php:52
Stack trace:
#0 /home/******/public_html/store/includes/system/versioned/1.0.5.1/customer.php(52): array_filter(NULL, Object(Closure))
#1 /home/******/public_html/store/includes/system/versioned/1.0.5.1/customer.php(79): customer->fetch_address(4875)
#2 /home/******/public_html/store/includes/system/versioned/1.0.7.10/cart_order_builder.php(72): customer->fetch_to_address('4875')
#3 /home/******/public_html/store/includes/system/versioned/1.0.7.10/cart_order_builder.php(149): cart_order_builder->build_addresses()
#4 /home/******/public_html/store/includes/system/versioned/1.0.7.10/order.php(25): cart_order_builder::build(Object(order))
#5 /home/******/public_html/store/includes/modules/content/shopping_cart/cm_sc_shipping.php(42): order->__construct()
#6 /home/******/public_html/store/includes/system/versioned/1.0.8.4/template.php(106): cm_sc_shipping->execute()
#7 /home/******/public_html/store/templates/xpajun/includes/pages/shopping_cart.php(13): Template->get_content('shopping_cart')
#8 /home/******/public_html/store/shopping_cart.php(17): require('/home/******/...')
#9 {main}
  thrown in /home/******/public_html/store/includes/system/versioned/1.0.5.1/customer.php on line 52
[18-May-2024 20:14:19 UTC] PHP Fatal error:  Uncaught TypeError: array_filter(): Argument #1 ($array) must be of type array, null given in /home/******/public_html/store/includes/system/versioned/1.0.5.1/customer.php:52
Stack trace:
#0 /home/******/public_html/store/includes/system/versioned/1.0.5.1/customer.php(52): array_filter(NULL, Object(Closure))
#1 /home/******/public_html/store/includes/system/versioned/1.0.5.1/customer.php(79): customer->fetch_address(4875)
#2 /home/******/public_html/store/includes/system/versioned/1.0.7.10/cart_order_builder.php(72): customer->fetch_to_address('4875')
#3 /home/******/public_html/store/includes/system/versioned/1.0.7.10/cart_order_builder.php(149): cart_order_builder->build_addresses()
#4 /home/******/public_html/store/includes/system/versioned/1.0.7.10/order.php(25): cart_order_builder::build(Object(order))
#5 /home/******/public_html/store/includes/modules/content/shopping_cart/cm_sc_shipping.php(42): order->__construct()
#6 /home/******/public_html/store/includes/system/versioned/1.0.8.4/template.php(106): cm_sc_shipping->execute()
#7 /home/******/public_html/store/templates/xpajun/includes/pages/shopping_cart.php(13): Template->get_content('shopping_cart')
#8 /home/******/public_html/store/shopping_cart.php(17): require('/home/******/...')
#9 {main}
  thrown in /home/******/public_html/store/includes/system/versioned/1.0.5.1/customer.php on line 52
[18-May-2024 20:14:21 UTC] PHP Warning:  Undefined variable $order_id in /home/******/public_html/store/templates/xpajun/includes/pages/shopping_cart.php on line 19
[18-May-2024 20:14:23 UTC] PHP Fatal error:  Uncaught TypeError: Text::output(): Argument #1 ($s) must be of type string, null given, called in /home/******/public_html/store/includes/system/versioned/1.0.8.other/1.0.8.21/select.php on line 72 and defined in /home/******/public_html/store/includes/system/versioned/1.0.8.2/text.php:59
Stack trace:
#0 /home/******/public_html/store/includes/system/versioned/1.0.8.other/1.0.8.21/select.php(72): Text::output(NULL, Array)
#1 /home/******/public_html/store/includes/system/versioned/1.0.8.other/1.0.8.21/select.php(97): Select->build_options()
#2 /home/******/public_html/store/includes/system/versioned/1.0.8.other/1.0.8.21/select.php(178): Select->draw()
#3 /home/******/public_html/store/includes/modules/content/product_info/templates/tpl_cm_pi_options_attributes.php(15): Select->__toString()
#4 /home/******/public_html/store/includes/modules/content/cm_template.php(14): include('/home/******/...')
#5 /home/******/public_html/store/includes/modules/content/product_info/cm_pi_options_attributes.php(25): include('/home/******/...')
#6 /home/******/public_html/store/includes/system/versioned/1.0.8.4/template.php(106): cm_pi_options_attributes->execute()
#7 /home/******/public_html/store/templates/xpajun/includes/pages/product_info.php(35): Template->get_content('product_info')
#8 /home/******/public_html/store/product_info.php(25): require('/home/******/...')
#9 {main}
  thrown in /home/******/public_html/store/includes/system/versioned/1.0.8.2/text.php on line 59

I've checked the above files they all check out to 1.0.8.21 - php is 8.2.18

Re: Shopping Cart not showing

Posted: Sat May 18, 2024 9:12 pm
by Xpajun
Seems to be a database error :(

Re: Shopping Cart not showing

Posted: Sat May 18, 2024 10:27 pm
by ecartz
Does address 4875 exist in the database (address_book table)?

Re: Shopping Cart not showing

Posted: Sun May 19, 2024 11:03 am
by Xpajun
ecartz wrote: Sat May 18, 2024 10:27 pm Does address 4875 exist in the database (address_book table)?
It does but not related to the customer - I was being too cocky in the database tables while being too tired as well
Everything was further complicated by cashe - cleared that this morning and everything was working properly - well almost - I'm now getting a blank page on checkout success.php
Think this is the error:

Code: Select all

[19-May-2024 10:47:53 UTC] PHP Fatal error:  Uncaught TypeError: Text::output(): Argument #1 ($s) must be of type string, null given, called in /home/******/public_html/store/includes/system/versioned/1.0.8.other/1.0.8.21/select.php on line 72 and defined in /home/******/public_html/store/includes/system/versioned/1.0.8.2/text.php:59
Stack trace:
#0 /home/******/public_html/store/includes/system/versioned/1.0.8.other/1.0.8.21/select.php(72): Text::output(NULL, Array)
#1 /home/******/public_html/store/includes/system/versioned/1.0.8.other/1.0.8.21/select.php(97): Select->build_options()
#2 /home/******/public_html/store/includes/system/versioned/1.0.8.other/1.0.8.21/select.php(178): Select->draw()
#3 /home/******/public_html/store/includes/modules/content/product_info/templates/tpl_cm_pi_options_attributes.php(15): Select->__toString()
#4 /home/******/public_html/store/includes/modules/content/cm_template.php(14): include('/home/******/...')
#5 /home/******/public_html/store/includes/modules/content/product_info/cm_pi_options_attributes.php(25): include('/home/******/...')
#6 /home/******/public_html/store/includes/system/versioned/1.0.8.4/template.php(106): cm_pi_options_attributes->execute()
#7 /home/******/public_html/store/templates/xpajun/includes/pages/product_info.php(35): Template->get_content('product_info')
#8 /home/******/public_html/store/product_info.php(25): require('/home/******/...')
#9 {main}
  thrown in /home/******/public_html/store/includes/system/versioned/1.0.8.2/text.php on line 59

Although everything went through OK

Re: Shopping Cart not showing

Posted: Sun May 19, 2024 11:22 am
by ecartz
It's complaining that the attribute option choices are not showing up correctly. In particular, that the text is null or not set. The most likely places would be pi_options_attributes or the Product class.

Re: Shopping Cart not showing

Posted: Sun May 19, 2024 6:46 pm
by Xpajun
ecartz wrote: Sun May 19, 2024 11:22 am It's complaining that the attribute option choices are not showing up correctly. In particular, that the text is null or not set. The most likely places would be pi_options_attributes or the Product class.
Thank you for your help Matt @ecartz checked all those those files they are the same on my site as the 1.8.0.21 full download

I then did a couple of test orders one with attributes and one without... they both went through OK :shock:

Re: Shopping Cart not showing

Posted: Sat May 25, 2024 11:48 am
by Xpajun
ecartz wrote: Sun May 19, 2024 11:22 am It's complaining that the attribute option choices are not showing up correctly. In particular, that the text is null or not set. The most likely places would be pi_options_attributes or the Product class.
It's back again and both when ordering products with attributes and products without here's the errors and the related lines being objeted to:

Code: Select all

[25-May-2024 10:08:28 UTC] PHP Fatal error:  Uncaught TypeError: Text::output(): Argument #1 ($s) must be of type string, null given, called in /home/mudlarki/public_html/store/includes/system/versioned/1.0.8.other/1.0.8.21/select.php on line 72 and defined in /home/mudlarki/public_html/store/includes/system/versioned/1.0.8.2/text.php:59
Stack trace:
#0 /home/mudlarki/public_html/store/includes/system/versioned/1.0.8.other/1.0.8.21/select.php(72): Text::output(NULL, Array)
#1 /home/mudlarki/public_html/store/includes/system/versioned/1.0.8.other/1.0.8.21/select.php(97): Select->build_options()
#2 /home/mudlarki/public_html/store/includes/system/versioned/1.0.8.other/1.0.8.21/select.php(178): Select->draw()
#3 /home/mudlarki/public_html/store/includes/modules/content/product_info/templates/tpl_cm_pi_options_attributes.php(15): Select->__toString()
#4 /home/mudlarki/public_html/store/includes/modules/content/cm_template.php(14): include('/home/mudlarki/...')
#5 /home/mudlarki/public_html/store/includes/modules/content/product_info/cm_pi_options_attributes.php(25): include('/home/mudlarki/...')
#6 /home/mudlarki/public_html/store/includes/system/versioned/1.0.8.4/template.php(106): cm_pi_options_attributes->execute()
#7 /home/mudlarki/public_html/store/templates/xpajun/includes/pages/product_info.php(26): Template->get_content('product_info')
#8 /home/mudlarki/public_html/store/product_info.php(25): require('/home/mudlarki/...')
#9 {main}
  thrown in /home/mudlarki/public_html/store/includes/system/versioned/1.0.8.2/text.php on line 59



#0        $field .= '>' . Text::output($option['text'], static::ESCAPES) . '</option>';


#1      $select = '<select' . $this->stringify_parameters() . '>' . $this->build_options() . '</select>';


#2      return $this->draw();

#3      $input = $input->require() . PHP_EOL . FORM_REQUIRED_INPUT;


#4  include(Guarantor::ensure_global('Template')->map($tpl_data['file']));


#5        include 'includes/modules/content/cm_template.php';


#6            $mb->execute();


#7    <?= $Template->get_content('product_info') ?>



#8    require $Template->map(__FILE__, 'page');



#9    public static function output(string $s, $translate = false) {

My initial thought was that when a product without attributes was ordered a NULL return would happen and cause the problem.
I don't use pi preferring product_tabs instead because it fits better with what I sell - has tabs been updated since d21?

Re: Shopping Cart not showing

Posted: Sat May 25, 2024 12:42 pm
by ecartz
The products class returns an array of options/attributes. The cm_pi_options_attributes copies parts of that array into another array with different structure. Then the tpl displays it. The tpl is saying that some of the values are null. That happens well after the array is created. The problem would be at creation, not when it is being read.

If all the code is core, then the next thing to check would be that the values are correct in the database. If it's happening consistently, try adding code in cm_pi_options_attributes to detect nulls and dump the data at that point. If this paragraph does not make sense to you, then you may need to escalate to a certified developer for debugging help.