2012-04-03 2 views
10

एक ग्राहक के पास जेन कार्ट 1.5 में एक कस्टम शिपिंग मॉड्यूल है। कल मैंने मॉड्यूल को क्षेत्र-जागरूक होने के लिए अनुकूलित किया था (वे चाहते थे कि मूल मॉड्यूल संयुक्त राज्य अमेरिका पर लागू हो, और गैर-यूएसए आदेशों के लिए एक प्रतिलिपि बनाई जा सके)।ग्राहक के शिपिंग विकल्प जेन कार्ट 1.5 में डेटाबेस या मॉड्यूल सेटिंग्स से मेल नहीं खाते हैं?

अब मेरे पास उस मॉड्यूल में केवल एक शिपिंग विकल्प है, कॉन्फ़िगर नहीं किया गया चार। ज़ोन जागरूकता काम कर रही प्रतीत होती है (मेरे परीक्षण आदेश दिखाते हैं कि विकल्प के लिए, अंतरराष्ट्रीय शुल्क नहीं, बल्कि संयुक्त विकल्प दिखाता है) लेकिन केवल पहला विकल्प दिखाता है। चार चयनित कोड में सूचीबद्ध साथ

/*include functions/functions_categories.pnp for zen_product_in_category method 
*/ 
class tfn 
{ 
    var $code, $title, $description, $icon, $enabled, $types; 

    // class constructor 
    function tfn() { 
     global $order, $db, $types, $fees; 

     $this->code = 'tfn'; 
     $this->title = MODULE_SHIPPING_TFN_TEXT_TITLE; 
     $this->description = MODULE_SHIPPING_TFN_TEXT_DESCRIPTION; 
     $this->sort_order = MODULE_SHIPPING_TFN_SORT_ORDER; 
     $this->icon = ''; 
     $this->tax_class = MODULE_SHIPPING_TFN_TAX_CLASS; 
     $this->tax_basis = MODULE_SHIPPING_TFN_TAX_BASIS; 

     // disable only when entire cart is free shipping 
     if (zen_get_shipping_enabled($this->code)) { 
      $this->enabled = ((MODULE_SHIPPING_TFN_STATUS == 'True') ? true : false); 
     } 

     if (($this->enabled == true) && ((int)MODULE_SHIPPING_TFN_ZONE > 0)) { 
      $check_flag = false; 
      $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_TFN_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id"); 
      while (!$check->EOF) { 
       if ($check->fields['zone_id'] < 1) { 
        $check_flag = true; 
        break; 
       } elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) { 
        $check_flag = true; 
        break; 
       } 
       $check->MoveNext(); 
      } 

      if ($check_flag == false) { 
       $this->enabled = false; 
      } 
     } 

     $types = array(
      'STD' => 'Standard', 
      'FXH' => 'USPS Priority Mail', 
      'FXES' => 'USPS Express Mail', 
      'FXSO' => 'FedEx Overnight' 
     ); 
     // 'FAM' => 'Foreign Airmail', 
     // 'FXG' => 'USPS Priority Mail with Delivery Confirmation', 
     // 'FX2D' => 'FedEx 2nd Day', 

     $fees = array(
      'STD' => '0.00', 
      'FXH' => '4.50', 
      'FXES' => '17.50', 
      'FXSO' => '28.00' 
     ); 
     // 'FAM' => '15.00', 
     // 'FXG' => '5.50', 
     // 'FX2D' => '10.00', 
    } 

    // class methods 
    function quote($method = '') { 
     global $order, $types, $fees; 

     $methods = array(); 

     $this->quotes = array(
      'id'  => $this->code, 
      'module' => $this->title 
     ); 

     if (($method == '') || (!isset($method))) { 
      foreach ($fees as $type => $cost) { 
       $methods[] = array(
        'id' => $type, 
        'title' => $types[$type], 
        'cost' => $this->_calculateBaseCost() + $cost 
       ); 
      } 
     } else { 
      $cost = $fees[$method]; 
      $methods[] = array(
       'id' => $method, 
       'title' => $types[$method], 
       'cost' => $this->_calculateBaseCost() + $cost 
      ); 
     } 

     $this->quotes['methods'] = $methods; 
     if ($this->tax_class > 0) { 
      $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); 
     } 

     if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon, $this->title); 

     return $this->quotes; 
    } 

    function _calculateBaseCost() { 
     global $db, $shipping_cost; 

     $total_count = $_SESSION['cart']->count_contents(); 
     $total_count = $total_count - $_SESSION['cart']->free_shipping_items(); 
     $foreign_charge = $this->_additionalForeignCharge(); 
     $shipping_cost = ($total_count * (MODULE_SHIPPING_TFN_BASE_COST + $foreign_charge)); 

     return $shipping_cost; 
    } 

    function _additionalForeignCharge() { 
     global $db, $order; 

     $foreign_charge = 0; 

     $dest_country = $order->delivery['country']['iso_code_2']; 

     if ($dest_country != 'US') { 
      $foreign_charge = MODULE_SHIPPING_TFN_FOREIGN_COST; 
     } 

     return $foreign_charge; 
    } 

    function check() { 
     global $db; 
     if (!isset($this->_check)) { 
      $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_TFN_STATUS'"); 
      $this->_check = $check_query->RecordCount(); 
     } 

     return $this->_check; 
    } 

    function install() { 
     global $db; 
     $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Item Shipping', 'MODULE_SHIPPING_TFN_STATUS', 'True', 'Do you want to offer per item rate shipping?', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())"); 
     $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Shipping Cost', 'MODULE_SHIPPING_TFN_BASE_COST', '2.50', 'The shipping cost will be multiplied by the number of items in an order that uses this shipping method.', '6', '0', now())"); 
     $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Additional Foreign Shipping Cost', 'MODULE_SHIPPING_TFN_FOREIGN_COST', '4.00', 'The additional foreign shipping cost will be multiplied by the number of items and added to the base cost.', '6', '0', now())"); 
     $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_TFN_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'zen_get_tax_class_title', 'zen_cfg_pull_down_tax_classes(', now())"); 
     $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Tax Basis', 'MODULE_SHIPPING_TFN_TAX_BASIS', 'Shipping', 'On what basis is Shipping Tax calculated. Options are<br />Shipping - Based on customers Shipping Address<br />Billing Based on customers Billing address<br />Store - Based on Store address if Billing/Shipping Zone equals Store zone', '6', '0', 'zen_cfg_select_option(array(\'Shipping\', \'Billing\', \'Store\'), ', now())"); 
     $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_TFN_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())"); 
     $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_TFN_SHIPPING_TYPES', '0', 'Code and Name for each kind of shipping offered.', '6', '0', now())"); 
     $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Shipping Methods: <br />Standard, Foreign Airmail, FedEx Home Delivery, FedEx Ground, FedEx Express Saver, FedEx 2nd Day, FedEx Standard Overnight', 'MODULE_SHIPPING_TFN_TYPES', 'STD, FAM, FXHD, FXG, FXES, FX2D, FXSO', 'Select the TFN services to be offered.', '6', '13', 'zen_cfg_select_multioption(array(\'STD\',\'FAM\',\'FXHD\', \'FXG\', \'FXES\', \'FX2D\', \'FXSO\'), ', now())"); 
     $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_TFN_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())"); 
    } 

    function remove() { 
     global $db; 
     $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); 
    } 

    function keys() { 
     return array(
      'MODULE_SHIPPING_TFN_STATUS', 'MODULE_SHIPPING_TFN_BASE_COST', 
      'MODULE_SHIPPING_TFN_FOREIGN_COST', 'MODULE_SHIPPING_TFN_TAX_CLASS', 
      'MODULE_SHIPPING_TFN_TAX_BASIS', 'MODULE_SHIPPING_TFN_SORT_ORDER', 
      'MODULE_SHIPPING_TFN_TYPES', 'MODULE_SHIPPING_TFN_ZONE' 
     ); 
    } 
} 
?> 

व्यवस्थापक पृष्ठ आठ शिपिंग विकल्प पता चलता है,:

यहाँ मॉड्यूल के कोड है।

यहाँ अंतरराष्ट्रीय मॉड्यूल सहित प्रासंगिक डेटाबेस प्रविष्टियों, है:

mysql> select configuration_value, configuration_key from configuration where configuration_key LIKE 'MODULE_SHIPPING_%_TYPES'; 
+-----------------------+----------------------------------------+ 
| configuration_value | configuration_key      | 
+-----------------------+----------------------------------------+ 
| 0      | MODULE_SHIPPING_TFN_INT_SHIPPING_TYPES | 
| STD     | MODULE_SHIPPING_TFN_INT_TYPES   | 
| 0      | MODULE_SHIPPING_TFN_SHIPPING_TYPES  | 
| STD, FXHD, FXES, FXSO | MODULE_SHIPPING_TFN_TYPES    | 
+-----------------------+----------------------------------------+ 
4 rows in set (0.00 sec) 

_SHIPPING_TYPES सेटिंग को अपडेट करना डेटाबेस में सीधे (उदा 1 बजाय 0 के लिए यह स्थापित करने) कुछ भी बदलने की नहीं लगती। मुझे कोई भी कोड नहीं मिल रहा है जो इस सेटिंग को कॉल करता है।

जेन कार्ट शिपिंग विकल्पों का निर्धारण कहां है? मैं इसे उन लोगों को कैसे दिखा सकता हूं जिन्हें मैं चाहता हूं?

+0

ठीक है, यह थोड़ा हास्यास्पद है। यदि यह प्रश्न असंभव है, तो क्या कोई कम से कम टिप्पणी कर सकता है और मुझे बता सकता है कि कौन सी जानकारी गुम है जो इसे उत्तरदायी बनाती है? क्या इतना बड़ा हो गया है कि बक्षीस अनधिकृत हो जाएं? – pjmorse

+0

दो बक्षीस अनधिकृत? – pjmorse

+0

मैं इस सप्ताह के अंत में इस समस्या को देखने की कोशिश करूंगा –

उत्तर

0

शिपिंग मॉड्यूल फाइलिंग नामकरण और शिपिंग विकल्प की फ़ाइल संरचना में गलती के कारण आमतौर पर इसे प्रदर्शित नहीं करते हैं। आप जानते हैं कि ज़ेन कार्ट में 1 पेज जोड़ने के लिए आपको 50 अलग-अलग फाइलें कैसे बनाना है?

सावधानी से यहां दिए गए निर्देशों का पालन करें और सुनिश्चित करें कि आपके नामकरण सम्मेलन के साथ-साथ फ़ाइल प्लेसमेंट सभी सही हैं।

http://www.zen-cart.com/wiki/index.php/Creating_Your_Own_Shipping_Module

+0

उत्तर के लिए धन्यवाद! मैं अब इस परियोजना पर काम नहीं कर रहा हूं, इसलिए मैं यह देखने के लिए जांच नहीं कर सकता कि यह काम करता है, लेकिन उम्मीद है कि अगर किसी और को यह प्रश्न मिल जाए तो उनके पास इसका उल्लेख होगा। – pjmorse

+0

मुझे आश्चर्य है कि मुझे 2012 की पोस्ट कैसे मिली। = \ – Nazca

+0

आमतौर पर यह मेरे लिए खोज करता है। – pjmorse

संबंधित मुद्दे