Hello, i'm not sure if it's suitable to write technical problems here.
As i looked into the jshopping code version 3.16.2 , i realize there are probably coding mistakes.
I want to add a new shipping method, namely ups or usps.
What i have in the table #__jshopping_shipping_ext_calc:
+----+----------------+--------------------+----------------+--------+-----------------+-----------+----------+
| id | name | alias | description | params | shipping_method | published | ordering |
+----+----------------+--------------------+----------------+--------+-----------------+-----------+----------+
| 1 | StandartWeight | sm_standart_weight | StandartWeight | | | 1 | 1 |
| 2 | usps | usps | usps | | | 1 | 2 |
| 3 | Standard | standard | standard | | | 1 | 3 |
+----+----------------+--------------------+----------------+--------+-----------------+-----------+----------+
Code block:
File: components/com_jshopping/tables/shippingmethodprice.php
function calculateSum(&$cart){
$jshopConfig = JSFactory::getConfig();
if ($this->getGlobalConfigPriceNull($cart)){
return 0;
}
$price = $this->shipping_stand_price;
$package = $this->package_stand_price;
$prices = array('shipping'=>$price,'package'=>$package);
$extensions = JSFactory::getShippingExtList($this->shipping_method_id);
foreach($extensions as $extension){
if (isset($extension->exec->version) && $extension->exec->version==2){
$prices = $extension->exec->getPrices($cart, $this->getParams(), $prices, $extension, $this);
} else {
$price = $extension->exec->getPrice($cart, $this->getParams(), $price, $extension, $this);
$prices = array('shipping'=>$price,'package'=>$package);
}
}
The code block calling the above code is below:
File:com_jshopping/controolers/checkout.php Function step4
$shippings = $shippingmethod->getAllShippingMethodsCountry($id_country, $payment_id);
foreach($shippings as $key=>$value){
$shippingmethodprice->load($value->sh_pr_method_id);
if ($jshopConfig->show_list_price_shipping_weight){
$shippings[$key]->shipping_price = $shippingmethodprice->getPricesWeight($value->sh_pr_method_id, $id_country, $cart);
}
$prices = $shippingmethodprice->calculateSum($cart);
==============Bugs??? ==============
foreach($extensions as $extension){ in function calculateSum always results in the last shipping method's values, in this example it its 'Standard' shipping method, so what's the point of this function? I get all the same shipping rates in frontend for these 3 shipping methods
Joomla: 2.5
JoomShopping: 3.16.2
PHP: 5.2
MySQL: 5.1.44
Website Url: local test site
JoomShopping: 3.16.2
PHP: 5.2
MySQL: 5.1.44
Website Url: local test site
Last change: 29.03.2014 07:52