に表示するカスタムフィールドは、製品モジュール人気商品opencart
現在それだけで、製品ページには、このフィールドを示し 注目のモジュールでこのフィールドを表示する必要が人気製品
私はすでにコントローラーに カタログ/コントローラ/拡張/モジュール/ featured.php $データをこのコードを入れて[ 'extra_field'] =がhtml_entity_decode($ product_info [ 'extra_field']、ENT_QUOTES、「UTF-8 ');
仕事はありません... 誰かが私を助けることができますか?
これは、あなたも、あなたのコードが機能の製品での作業を取得する必要があります
<modification>
<name><![CDATA[<font color="#000000"><b>sale</font>]]></name>
<code>product_extra_field</code>
<version>1.0</version>
<link></link>
<file path="admin/controller/catalog/product.php">
<operation>
<search><![CDATA[if (isset($this->request->post['points'])) {]]></search>
<add position="before"><![CDATA[if ($this->db->query("SHOW TABLES LIKE '". DB_PREFIX ."product_extra_field'")->num_rows == 0) {
$sql = "CREATE TABLE IF NOT EXISTS `" . DB_PREFIX . "product_extra_field` (
`product_id` int(11) NOT NULL,
`language_id` int(11) NOT NULL,
`extra_field`VARCHAR(125) NOT NULL
) ENGINE=MyISAM COLLATE=utf8_general_ci";
$this->db->query($sql);
}
if (isset($this->request->post['product_extra_field'])) {
$data['product_extra_field'] = $this->request->post['product_extra_field'];
} elseif (isset($this->request->get['product_id'])) {
$data['product_extra_field'] = $this->model_catalog_product->getProductExtraField($this->request->get['product_id']);
} else {
$data['product_extra_field'] = array();
}]]></add>
</operation>
</file>
<file path="admin/model/catalog/product.php">
<operation>
<search><![CDATA[foreach ($data['product_description'] as $language_id => $value) {]]></search>
<add position="before"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "product_extra_field WHERE product_id = '" . (int)$product_id . "'");
foreach ($data['product_extra_field'] as $language_id => $value) {
$this->db->query("INSERT INTO " . DB_PREFIX . "product_extra_field SET product_id = '" . (int)$product_id . "', language_id = '" . (int)$language_id . "', extra_field = '" . $this->db->escape($value['extra_field']) . "'");
}]]></add>
</operation>
<operation>
<search><![CDATA[public function getProductOptions($product_id) {]]></search>
<add position="before"><![CDATA[public function getProductExtraField($product_id) {
$product_extra_field_data = array();
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_extra_field WHERE product_id = '" . (int)$product_id . "'");
foreach ($query->rows as $result) {
$product_extra_field_data[$result['language_id']] = array(
'extra_field' => $result['extra_field']
);
}
return $product_extra_field_data;
}]]></add>
</operation>
</file>
<file path="admin/view/template/catalog/product_form.tpl">
<operation>
<search index="0"><![CDATA[<div class="form-group">]]></search>
<add position="before"><![CDATA[<div class="form-group">
<label class="col-sm-2 control-label" for="input-extra_field<?php echo $language['language_id']; ?>">Texto personalizado</label>
<div class="col-sm-10">
<textarea class="form-control" name="product_extra_field[<?php echo $language['language_id']; ?>][extra_field]" placeholder="Digite aqui" id="input-extra_field<?php echo $language['language_id']; ?>"><?php echo isset($product_extra_field[$language['language_id']]) ? $product_extra_field[$language['language_id']]['extra_field'] : ''; ?></textarea>
</div>
</div>]]></add>
</operation>
</file>
<file path="catalog/controller/product/product.php">
<operation>
<search><![CDATA[$data['points'] = $product_info['points'];]]></search>
<add position="before"><![CDATA[$data['extra_field'] = html_entity_decode($product_info['extra_field'], ENT_QUOTES, 'UTF-8');]]></add>
</operation>
</file>
<file path="catalog/model/catalog/product.php">
<operation>
<search><![CDATA[return array(]]></search>
<add position="before"><![CDATA[
$extra_field_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_extra_field WHERE product_id = '" . (int)$product_id . "' AND language_id = '" . (int)$this->config->get('config_language_id') . "'");
if($extra_field_query->num_rows) {
$extra_field = $extra_field_query->row['extra_field'];
} else {
$extra_field = "";
}]]></add>
</operation>
<operation>
<search><![CDATA[return array(]]></search>
<add position="after">
<![CDATA[
'extra_field' => $extra_field,]]></add>
</operation>
</file>
<file path="catalog/view/theme/*/template/product/product.tpl">
<operation>
<search><![CDATA[<?php echo $heading_title; ?></h1>]]></search>
<add position="after"><![CDATA[<?php if(isset($extra_field) && $extra_field) { ?>
<?php echo $extra_field; ?>
<?php } ?>]]></add>
</operation>
</file>