News:

Support the VirtueMart project and become a member

Main Menu

Spinning wheel on 'add to cart'

Started by nistune, February 10, 2025, 12:08:04 PM

Previous topic - Next topic

nistune

Joomla 4.4.10
Virtuemart 4.4.6 11109

Problem: Spinning wheel when 'add to cart'

History. Site running since mid-May 2024 no issues with Virtuemart 4.4.4 11101. Problems started happening mid-January with customers reporting page getting stuck when 'add to cart'.

Unsure of exact cause. Upgraded to 4.4.6 11109 and still same issue. I'm not able to repeat it here with their accounts

More details of error log messages:
https://forum.virtuemart.net/index.php?topic=152268

Need some guidance on sorting this out

nistune

No feedback on this one so far so I've located parts of the codes. Not that really familiar with PHP to sort this one myself

Quote[11-Feb-2025 19:56:43 America/Chicago] PHP Warning:  Attempt to read property "virtuemart_category_id" on bool in /public_html/components/com_virtuemart/router.php on line 1576
[11-Feb-2025 19:56:43 America/Chicago] PHP Warning:  Attempt to read property "virtuemart_product_id" on bool in /public_html/components/com_virtuemart/router.php on line 1577

static public function getProductId( $names, $catId = NULL, $seo_sufix = true ){
...
    if(!empty($categoryName)){
        $prodIds[$hash]['virtuemart_category_id'] = self::getCategoryId($categoryName,$catId ) ;
    } else if(!empty($catId)){
        $prodIds[$hash]['virtuemart_category_id'] = $catId;
    } else {
        $product = VmModel::getModel('product')->getProduct($prodIds[$hash]['virtuemart_product_id']);
        vmRouterdebug('getProductId',$product->virtuemart_category_id); ***
        $prodIds[$hash]['virtuemart_category_id'] = $product->virtuemart_product_id; ***
    }

Quote[11-Feb-2025 21:30:34 America/Chicago] PHP Warning:  Undefined array key "username" in /public_html/administrator/components/com_virtuemart/models/user.php on line 673

    /**
    * Bind the post data to the JUser object and the VM tables, then saves it
    * It is used to register new users
    * This function can also change already registered users, this is important when a registered user changes his email within the checkout.

public function store(&$data){
 static public function filterAndWhiteListJUserData(&$user, &$data, $new, $usersConfig){

        $can_change_username = (int)$usersConfig->get('change_login_name', false);

        $data['username'] = vRequest::filter($data['username'],FILTER_SANITIZE_SPECIAL_CHARS,FILTER_FLAG_STRIP_LOW); ***

        $username = $user->get('username');
        if(!empty($username)){
            if(!empty($data['username'])){
                if(!$can_change_username  and !vmAccess::manager('user.edit')){
                    if($data['username']!=$username){
                        vmWarn('You are not allowed to change your username');
                    }
                    $data['username'] = $username;
                }
            } else {
                $data['username'] = $username;
            }
        }

Quote[10-Feb-2025 07:01:14 America/Chicago] PHP Warning:  Undefined array key "virtuemart_manufacturer_id" in /public_html/components/com_virtuemart/router.php on line 950

static function parseRoute($segments) {
...
    if (  self::compareKey($segments[0] ,'manufacturer') ) {
        if(!empty($segments[1])){
            array_shift($segments);
            $vars['virtuemart_manufacturer_id'] =  self::getManufacturerId($segments[0]);

        }


Quote[09-Feb-2025 10:55:48 America/Chicago] PHP Warning:  foreach() argument must be of type array|object, null given in /public_html/administrator/components/com_virtuemart/models/product.php on line 3316

public function getPrice ($product, $quantity, $ctype=-1) {
...
    if(VmConfig::get('calculateVariantsOnFreshLoad',true)){
        $setvirtuemart_custom_id = array();
        foreach($product->customfields as $customfield) { ***
            if(!isset($setvirtuemart_custom_id[$customfield->virtuemart_custom_id])){
                if(empty($customfield->addEmpty)){
                    $product->customPlugin[$customfield->virtuemart_product_id][$customfield->virtuemart_custom_id] = (int) $customfield->virtuemart_customfield_id;
                    $setvirtuemart_custom_id[$customfield->virtuemart_custom_id] = 1;
                }
            }
        }
        //vmdebug('getPrice ',$product->customPlugin);
    }


Quote[09-Feb-2025 10:55:48 America/Chicago] PHP Warning:  Attempt to read property "customfields" on bool in /public_html/administrator/components/com_virtuemart/models/product.php on line 3316

public function getPrice ($product, $quantity, $ctype=-1) {
...
    if (empty($product->customfields) and $product->customfields!=array() and !empty($product->allIds)) { ***
        $customfieldsModel = VmModel::getModel ('Customfields');
        $product->modificatorSum = null;
        $product->customfields = $customfieldsModel->getCustomEmbeddedProductCustomFields ($product->allIds,0,$ctype);
    }