2014-01-10 51 views
0

I/m新增至opencart和php。我正在嘗試使用opencart建立我的在線商店。 我試圖在結帳頁面中添加一個自定義字段。 我使用OC 1.5.4。 下面是我寫的vqmod。問題是表沒有得到更新。opencart在結帳頁面中的自定義字段

請大家幫忙,我要去哪裏錯了

<modification> 
<id>Custom Field in checkout</id> 
<version>1</version> 
<vqmver>2.4</vqmver> 
<author>arun</author> 
<file name="catalog/view/theme/bigshop/template/checkout/shipping_method.tpl"> 
    <operation> 
     <search position="before"><![CDATA[ 
      <p><?php echo $text_shipping_method; ?></p> 
     ]]></search> 
     <add><![CDATA[ 
      <p><?php echo $text_shipping_timeslot; ?></p> 
      <table class="radio"> 

     <tr class="highlight"> 
     <td colspan="3"><b><?php echo "Delivery time slot"; ?></b></td> 
     <td> 
     <input type="text" name="selection" value="<?php echo $selection; ?>" id="selection"? 
     </td> 
     </tr> 

     </table> 
     ]]></add> 
    </operation> 
</file> 
<file name="catalog/language/english/checkout/checkout.php"> 
    <operation> 
     <search position="before"><![CDATA[ 
      $_['text_shipping_method']   = 'Please select the preferred shipping method to use on this order.'; 
     ]]></search> 
     <add><![CDATA[ 
      $_['text_shipping_timeslot']   = 'Please select the preferred shipping time slot.'; 

     ]]></add> 
    </operation> 
</file> 


    <file name="catalog/controller/checkout/shipping_method.php"> 
     <operation> 
      <search position="before"><![CDATA[ 
       $this->data['text_shipping_method'] = $this->language->get('text_shipping_method'); 
      ]]></search> 
      <add><![CDATA[ 
       $this->data['text_shipping_timeslot'] = $this->language->get('text_shipping_timeslot'); 

       if (isset($this->request->post['selection'])) { 
      $this->data['selection'] = $this->request->post['selection']; 
     } else { 
      $this->data['selection'] = '';} 


]]></add> 
     </operation> 

    </file> 





<file name="catalog/model/checkout/order.php"> 
     <operation> 
      <search position="replace"><![CDATA[ 
       $this->db->query("INSERT INTO `" . DB_PREFIX . "order` SET invoice_prefix = '" . $this->db->escape($data['invoice_prefix']) . "', store_id = '" . (int)$data['store_id'] . "', store_name = '" . $this->db->escape($data['store_name']) . "', store_url = '" . $this->db->escape($data['store_url']) . "', customer_id = '" . (int)$data['customer_id'] . "', customer_group_id = '" . (int)$data['customer_group_id'] . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', fax = '" . $this->db->escape($data['fax']) . "', payment_firstname = '" . $this->db->escape($data['payment_firstname']) . "', payment_lastname = '" . $this->db->escape($data['payment_lastname']) . "', payment_company = '" . $this->db->escape($data['payment_company']) . "', payment_company_id = '" . $this->db->escape($data['payment_company_id']) . "', payment_tax_id = '" . $this->db->escape($data['payment_tax_id']) . "', payment_address_1 = '" . $this->db->escape($data['payment_address_1']) . "', payment_address_2 = '" . $this->db->escape($data['payment_address_2']) . "', payment_city = '" . $this->db->escape($data['payment_city']) . "', payment_postcode = '" . $this->db->escape($data['payment_postcode']) . "', payment_country = '" . $this->db->escape($data['payment_country']) . "', payment_country_id = '" . (int)$data['payment_country_id'] . "', payment_zone = '" . $this->db->escape($data['payment_zone']) . "', payment_zone_id = '" . (int)$data['payment_zone_id'] . "', payment_address_format = '" . $this->db->escape($data['payment_address_format']) . "', payment_method = '" . $this->db->escape($data['payment_method']) . "', payment_code = '" . $this->db->escape($data['payment_code']) . "', shipping_firstname = '" . $this->db->escape($data['shipping_firstname']) . "', shipping_lastname = '" . $this->db->escape($data['shipping_lastname']) . "', shipping_company = '" . $this->db->escape($data['shipping_company']) . "', shipping_address_1 = '" . $this->db->escape($data['shipping_address_1']) . "', shipping_address_2 = '" . $this->db->escape($data['shipping_address_2']) . "', shipping_city = '" . $this->db->escape($data['shipping_city']) . "', shipping_postcode = '" . $this->db->escape($data['shipping_postcode']) . "', shipping_country = '" . $this->db->escape($data['shipping_country']) . "', shipping_country_id = '" . (int)$data['shipping_country_id'] . "', shipping_zone = '" . $this->db->escape($data['shipping_zone']) . "', shipping_zone_id = '" . (int)$data['shipping_zone_id'] . "', shipping_address_format = '" . $this->db->escape($data['shipping_address_format']) . "', shipping_method = '" . $this->db->escape($data['shipping_method']) . "', shipping_code = '" . $this->db->escape($data['shipping_code']) . "', comment = '" . $this->db->escape($data['comment']) . "', total = '" . (float)$data['total'] . "', affiliate_id = '" . (int)$data['affiliate_id'] . "', commission = '" . (float)$data['commission'] . "', language_id = '" . (int)$data['language_id'] . "', currency_id = '" . (int)$data['currency_id'] . "', currency_code = '" . $this->db->escape($data['currency_code']) . "', currency_value = '" . (float)$data['currency_value'] . "', ip = '" . $this->db->escape($data['ip']) . "', forwarded_ip = '" . $this->db->escape($data['forwarded_ip']) . "', user_agent = '" . $this->db->escape($data['user_agent']) . "', accept_language = '" . $this->db->escape($data['accept_language']) . "', date_added = NOW(), date_modified = NOW()"); 
     ]]></search> 
      <add><![CDATA[ 
       $this->db->query("INSERT INTO `" . DB_PREFIX . "order` SET invoice_prefix = '" . $this->db->escape($data['invoice_prefix']) . "', store_id = '" . (int)$data['store_id'] . "', store_name = '" . $this->db->escape($data['store_name']) . "', store_url = '" . $this->db->escape($data['store_url']) . "', customer_id = '" . (int)$data['customer_id'] . "', customer_group_id = '" . (int)$data['customer_group_id'] . "', firstname = '" . $this->db->escape($data['firstname']) . "', lastname = '" . $this->db->escape($data['lastname']) . "', email = '" . $this->db->escape($data['email']) . "', telephone = '" . $this->db->escape($data['telephone']) . "', fax = '" . $this->db->escape($data['fax']) . "', payment_firstname = '" . $this->db->escape($data['payment_firstname']) . "', payment_lastname = '" . $this->db->escape($data['payment_lastname']) . "', payment_company = '" . $this->db->escape($data['payment_company']) . "', payment_company_id = '" . $this->db->escape($data['payment_company_id']) . "', payment_tax_id = '" . $this->db->escape($data['payment_tax_id']) . "', payment_address_1 = '" . $this->db->escape($data['payment_address_1']) . "', payment_address_2 = '" . $this->db->escape($data['payment_address_2']) . "', payment_city = '" . $this->db->escape($data['payment_city']) . "', payment_postcode = '" . $this->db->escape($data['payment_postcode']) . "', payment_country = '" . $this->db->escape($data['payment_country']) . "', payment_country_id = '" . (int)$data['payment_country_id'] . "', payment_zone = '" . $this->db->escape($data['payment_zone']) . "', payment_zone_id = '" . (int)$data['payment_zone_id'] . "', payment_address_format = '" . $this->db->escape($data['payment_address_format']) . "', payment_method = '" . $this->db->escape($data['payment_method']) . "', payment_code = '" . $this->db->escape($data['payment_code']) . "', shipping_firstname = '" . $this->db->escape($data['shipping_firstname']) . "', shipping_lastname = '" . $this->db->escape($data['shipping_lastname']) . "', shipping_company = '" . $this->db->escape($data['shipping_company']) . "', shipping_address_1 = '" . $this->db->escape($data['shipping_address_1']) . "', shipping_address_2 = '" . $this->db->escape($data['shipping_address_2']) . "', shipping_city = '" . $this->db->escape($data['shipping_city']) . "', shipping_postcode = '" . $this->db->escape($data['shipping_postcode']) . "', shipping_country = '" . $this->db->escape($data['shipping_country']) . "', shipping_country_id = '" . (int)$data['shipping_country_id'] . "', shipping_zone = '" . $this->db->escape($data['shipping_zone']) . "', shipping_zone_id = '" . (int)$data['shipping_zone_id'] . "', shipping_address_format = '" . $this->db->escape($data['shipping_address_format']) . "', shipping_method = '" . $this->db->escape($data['shipping_method']) . "', shipping_code = '" . $this->db->escape($data['shipping_code']) . "', comment = '" . $this->db->escape($data['comment']) . "', total = '" . (float)$data['total'] . "', affiliate_id = '" . (int)$data['affiliate_id'] . "', commission = '" . (float)$data['commission'] . "', language_id = '" . (int)$data['language_id'] . "', currency_id = '" . (int)$data['currency_id'] . "', currency_code = '" . $this->db->escape($data['currency_code']) . "', currency_value = '" . (float)$data['currency_value'] . "', ip = '" . $this->db->escape($data['ip']) . "', forwarded_ip = '" . $this->db->escape($data['forwarded_ip']) . "', user_agent = '" . $this->db->escape($data['user_agent']) . "', accept_language = '" . $this->db->escape($data['accept_language']) . "', date_added = NOW(), date_modified = NOW(), selection = '" . $this->db->escape($data['selection']) . "'"); 
     ]]></add> 
     </operation> 
</file> 

</modification> 
+0

添加的新字段是否顯示在前面結束?驗證工作嗎? –

+0

是的......它顯示在前端......我可以在該字段中輸入值......也可以處理訂單......我在名稱'選擇'的順序表中添加了額外的字段。 ..但我無法在數據庫 –

+0

中查看錯誤日誌嗎? –

回答

0

步驟來嘗試:

  • 檢查vqmod是否通過調用瀏覽器https://domain.com/vqmod/install安裝。如果未安裝,請向上滾動並閱讀步驟。
  • 驗證文件名和路徑,並確認搜索標籤中的代碼存在於所提及的文件中。
  • 檢查文件夾權限。確保vqmod/vqcache和vqmod/logs具有755或777權限。如果什麼都不起作用,那麼遞歸地爲vqmod文件夾嘗試777權限。
  • 檢查vqmod/logs中的錯誤日誌。
  • 檢查安裝的vqmod版本和xml文件()中給出的vqmod版本,兩者都需要相同。
  • 刪除vqmod/vqcache中的文件並再次檢查。另請參閱是否生成文件的vqmod副本。
  • 將任何vqmod xml文件移到vqmod文件夾之外並檢查。如果一切正常,將xml移回到vqmod文件夾。我不知道原因,但在某些情況下它對我有用:)!
  • - 將此行放在XML的頂部,以使其有效且更兼容。
  • 嘗試使用VQMod Manager擴展。它可以幫助你!

參考鏈接:https://sankartypo3.wordpress.com/2013/11/25/opencart-vqmod-tutorial/

1

真的晚了答案,但可能會幫助別人的未來: 一個>缺少結尾:

<input type="text" name="selection" value="<?php echo $selection; ?>" 
    id="selection"? 

應該

<input type="text" name="selection" value="<?php echo $selection; ?>" 
    id="selection"? > 
相關問題