-- HikaShop version -- : 2.6.4
Hello
i'm using my custom shipping method, the shipping value is calculated and added into the total price but somehow the shipping price is set to 0
Here is my code details
foreach($local_usable_rates as $k => $rate){
/*Calculating prince*/
$rate->shipping_price = $real_cost;
$new_weight_volume = $totalweight." Kg";
$rate->shipping_description="
".JText::_('JNE_TOTAL_BERAT')." : ".$new_weight_volume."<br />
".JText::_('JNE_ESTIMASI_PENGIRIMAN')." : ".$real_etd." ".JText::_('JNE_HARI_KERJA')."<br />";
$usable_rates[$rate->shipping_id]=$rate;//add shipping to tthe list
}
this is the result of var_dump($rate)
object(stdClass)#1537 (16) {
["shipping_id"]=>
string(2) "14"
["shipping_type"]=>
string(10) "rajaongkir"
["shipping_zone_namekey"]=>
string(0) ""
["shipping_tax_id"]=>
string(1) "0"
["shipping_price"]=>
int(113625)
["shipping_currency_id"]=>
int(75)
["shipping_name"]=>
string(24) "POS - Paket Kilat Khusus"
["shipping_description"]=>
string(73) "
Total Weight / Volume : 3 Kg
Shipment : 2-4 Days
"
["shipping_published"]=>
string(1) "1"
["shipping_ordering"]=>
string(1) "5"
["shipping_currency"]=>
string(0) ""
["shipping_params"]=>
object(stdClass)#1546 (25) {
["shipping_percentage"]=>
string(1) "0"
["shipping_per_product"]=>
string(1) "0"
["shipping_price_per_product"]=>
string(0) ""
["shipping_override_address"]=>
string(1) "0"
["shipping_override_address_text"]=>
string(0) ""
["override_tax_zone"]=>
string(0) ""
["service_code"]=>
string(22) "pos|Paket Kilat Khusus"
["origin_city"]=>
string(3) "151"
["shipping_warehouse_filter"]=>
string(0) ""
["shipping_min_price"]=>
string(1) "0"
["shipping_max_price"]=>
string(1) "0"
["shipping_virtual_included"]=>
string(1) "0"
["shipping_price_use_tax"]=>
string(1) "1"
["shipping_min_quantity"]=>
string(0) ""
["shipping_max_quantity"]=>
string(0) ""
["shipping_min_weight"]=>
string(1) "0"
["shipping_weight_unit"]=>
string(2) "kg"
["shipping_max_weight"]=>
string(1) "0"
["shipping_min_volume"]=>
string(1) "0"
["shipping_size_unit"]=>
string(1) "m"
["shipping_max_volume"]=>
string(1) "0"
["shipping_zip_prefix"]=>
string(0) ""
["shipping_min_zip"]=>
string(0) ""
["shipping_max_zip"]=>
string(0) ""
["shipping_zip_suffix"]=>
string(0) ""
}
["shipping_images"]=>
string(0) ""
["shipping_access"]=>
string(3) "all"
["shippingkey"]=>
string(1) "0"
["shipping_currency_id_orig"]=>
string(1) "1"
}
and it works in front-end
however in the onShippingSave
when i var_dump($order)
array(1) {
[0]=>
object(stdClass)#47 (19) {
["shipping_id"]=>
string(2) "14"
["shipping_type"]=>
string(10) "rajaongkir"
["shipping_zone_namekey"]=>
string(0) ""
["shipping_tax_id"]=>
string(1) "0"
["shipping_price"]=>
int(0)
["shipping_currency_id"]=>
int(75)
["shipping_name"]=>
string(24) "POS - Paket Kilat Khusus"
["shipping_description"]=>
string(73) "
Total Weight / Volume : 5 Kg
Shipment : 2-4 Days
"
["shipping_published"]=>
string(1) "1"
["shipping_ordering"]=>
string(1) "5"
["shipping_currency"]=>
string(0) ""
["shipping_params"]=>
object(stdClass)#48 (25) {
["shipping_percentage"]=>
string(1) "0"
["shipping_per_product"]=>
string(1) "0"
["shipping_price_per_product"]=>
string(0) ""
["shipping_override_address"]=>
string(1) "0"
["shipping_override_address_text"]=>
string(0) ""
["override_tax_zone"]=>
string(0) ""
["service_code"]=>
string(22) "pos|Paket Kilat Khusus"
["origin_city"]=>
string(3) "151"
["shipping_warehouse_filter"]=>
string(0) ""
["shipping_min_price"]=>
string(1) "0"
["shipping_max_price"]=>
string(1) "0"
["shipping_virtual_included"]=>
string(1) "0"
["shipping_price_use_tax"]=>
string(1) "1"
["shipping_min_quantity"]=>
string(0) ""
["shipping_max_quantity"]=>
string(0) ""
["shipping_min_weight"]=>
string(1) "0"
["shipping_weight_unit"]=>
string(2) "kg"
["shipping_max_weight"]=>
string(1) "0"
["shipping_min_volume"]=>
string(1) "0"
["shipping_size_unit"]=>
string(1) "m"
["shipping_max_volume"]=>
string(1) "0"
["shipping_zip_prefix"]=>
string(0) ""
["shipping_min_zip"]=>
string(0) ""
["shipping_max_zip"]=>
string(0) ""
["shipping_zip_suffix"]=>
string(0) ""
}
["shipping_images"]=>
string(0) ""
["shipping_access"]=>
string(3) "all"
["shippingkey"]=>
string(1) "0"
["shipping_currency_id_orig"]=>
string(1) "1"
["shipping_warehouse_id"]=>
int(0)
["shipping_price_with_tax"]=>
int(0)
["shipping_price_orig_with_tax"]=>
NULL
}
}
The shipping price is turned into 0
The order recorded the selection but not the price, the email showing the order detail also didnt show shipping
Any suggestion how to fix this? Thank you
edit :
I used the same shipping method with different params in the backend
turns out my code that nullify the shipping when it detected that the shipping is unavailable doesnt disable the shipping.
$rate->shipping_published = 0;
$order->shipping[0]->shipping_price_with_tax = 0; //this one that changed the price
$order->shipping[0]->shipping_price = 0; //this one that changed the price
$rate->shipping_description="Pengiriman Tidak Dapat Di lakukan";
then i changed it to
to skip everything if the shipping method is not possible. I assume the shipping method will find the first shipping that it can find [in this case, the 1st option isnt available, hence the shipping price is 0].
the shipping is now working but i will keep eye on it if there is another bug showed up