zencart:商品項目追加(テキスト)
Posted on 月曜日, 11 月 9th, 2009 at 6:16 PMzencartにて 商品項目情報を追加する。
管理画面にて項目追加
CREATE TABLE product_item (
products_id int(11) NOT NULL default '0',
jan varchar(96) default NULL,
other varchar(96) default NULL,
arrival_date varchar(16) default NULL,
PRIMARY KEY (products_id)
) TYPE=MyISAM;
------
INSERT INTO product_type_layout
(configuration_title, configuration_key, configuration_value,
configuration_description, product_type_id, sort_order,
set_function, date_added)
VALUES ('JAN', 'SHOW_PRODUCT_INFO_JAN', '1',
'JANを表示する 0=表示しない 1=表示する', '1', '106',
'zen_cfg_select_drop_down(array(array(\'id\'=>\'1\', \'text\'=>\'True\'), array(\'id\'=>\'0\', \'text\'=>\'False\')), ', now());
INSERT INTO product_type_layout
(configuration_title, configuration_key, configuration_value,
configuration_description, product_type_id, sort_order,
set_function, date_added)
VALUES ('その他表示', 'SHOW_PRODUCT_INFO_OTHER', '1',
'その他を表示する 0=表示しない 1=表示する', '1', '107',
'zen_cfg_select_drop_down(array(array(\'id\'=>\'1\', \'text\'=>\'True\'), array(\'id\'=>\'0\', \'text\'=>\'False\')), ', now());
INSERT INTO product_type_layout
(configuration_title, configuration_key, configuration_value,
configuration_description, product_type_id, sort_order,
set_function, date_added)
VALUES ('入荷日表示', 'SHOW_PRODUCT_INFO_ARRIVAL_DATE', '1',
'入荷日を表示する 0=表示しない 1=表示する', '1', '108',
'zen_cfg_select_drop_down(array(array(\'id\'=>\'1\', \'text\'=>\'True\'), array(\'id\'=>\'0\', \'text\'=>\'False\')), ', now());
----------
/admin/includes/extra_datafiles/product_item.php
<?php
define('TABLE_PRODUCT_ITEM', DB_PREFIX . 'product_item');
?>
-------
/admin/includes/modules/product/collect_info.php
/////
$product_item = $db->Execute("select jan, other, arrival_date
from " . TABLE_PRODUCT_ITEM .
" where products_id = '" . (int)$_GET['pID']. "'");
//////
<tr>
<td class="main"><?php echo TEXT_PRODUCTS_JAN; ?></td>
<td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . ' ' . zen_draw_input_field('authers', $product_item->fields['jan']); ?></td>
</tr>
<tr>
<td class="main"><?php echo TEXT_PRODUCTS_OTHER; ?></td>
<td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . ' ' . zen_draw_input_field('size', $product_item->fields['other']); ?></td>
</tr>
<tr>
<td class="main"><?php echo TEXT_PRODUCTS_ARRIVAL_DATE; ?></td>
<td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . ' ' . zen_draw_input_field('publish_date', $product_item->fields['arrival_date']); ?></td>
</tr>
----
define('TEXT_PRODUCTS_JAN', 'JAN:');
define('TEXT_PRODUCTS_OTHER', 'その他:');
define('TEXT_PRODUCTS_ARRIVAL_DATE', '入荷日:');
-----------
/admin/includes/modules/update_product.php
$sql_data_array = array('products_id' => $products_id,
'jan' => zen_db_prepare_input($_POST['jan']),
'other' => zen_db_prepare_input($_POST['other']),
'arrival_date' => zen_db_prepare_input($_POST['arrival_date']) );
zen_db_perform(TABLE_PRODUCT_ITEM, $sql_data_array);
$sql_data_array = array('jan' => zen_db_prepare_input($_POST['jan']),
'other' => zen_db_prepare_input($_POST['other']),
'arrival_date' => zen_db_prepare_input($_POST['arrival_date']) );
zen_db_perform(TABLE_PRODUCT_ITEM,
$sql_data_array,
'update',
"products_id = '" . (int)$products_id . "'");
---------
関連記事
Leave a reply