문제

I have alot of scripts that do various different things outside opencart, but using the opencart database. They don't modify the database simply query it for the purpose of reporting and alike.

I want to query to the OpenCart database and the standard weight based shipping rates (domestic, uk). At the minute I cannot even figure out where those weight based shipping costs are stored, never mind look up the shipping price against the product.

$delivery_query=mysql_query("SELECT value FROM `oc_setting` T1 where T1.group = 'weight' and T1.key = 'weight_4_rate'");
while($row=mysql_fetch_array($delivery_query)){
 $delivery=explode(',',$row['value']);
 foreach($delivery as $rate){
  $delivery_arry[]=explode(':',$rate);
 }
}

Which is producing my delivery array:

Array
(
    [0] => Array
        (
            [0] => 100
            [1] => 1.58
        )

    [1] => Array
        (
            [0] => 250
            [1] => 1.96
        )

    [2] => Array
        (
            [0] => 500
            [1] => 2.48

Looping through my second array from the oc_products table I have outputted another array of products with weight, within that loop I need to lookup the price for the corresponding weight... This is now the bit I need help with!?

도움이 되었습니까?

해결책

Shipping costs are stored in the setting table, or oc_setting in your case. For the standard weight based shipping, the rates are stored with the key weight_X_rate where X is the geozone id, and have the group weight

enter image description here

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top