public static function getWeight() { $weight = 0; $weightObject = K2StoreFactory::getWeightObject(); JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_k2store/models'); $model = JModelLegacy::getInstance('Mycart', 'K2StoreModel'); $products = $model->getDataNew(); foreach ($products as $product) { if ($product['shipping']) { $weight += $weightObject->convert($product['weight_total'], $product['weight_class_id'], self::getStoreAddress()->config_weight_class_id); } } return $weight; }