zen cartの最近のブログ記事

zen cartはもともと英語で作られたので、日本語で「こうあってほしい」という部分が時々できていません。

例えば商品カテゴリが漢字の人物名で、それがあいうえお順に並んでほしいと思っても、セットアップしたままでは並びません。

なので、カテゴリを入力する際に、カテゴリ名をひらがなでも入力してもらって、それで並び替えることにしました。

修正ファイル備忘録

/public_html/admin/includes/languages/japanese/categories.php

/public_html/admin/includes/functions/general.php

/public_html/admin/includes/modules/category_product_listing.php

/public_html/admin/categories.php

サイトマップも
/public_html/includes/classes/site_map.php

メインカラムに展開されるカテゴリ名並び順は
/includes/modules/pages/index/main_template_vars.php

詳細検索の並び順は
/public_html/includes/functions/functions_categories.php

METAタグの文字切り出し

| コメント(0)
/public_html/includes/functions/functions_general.php
のzen_truncate_paragraphというファンクションでMETA descriptionの表示文字を設定しているのですが、zen cartはもともと英語で開発されているので、半角スペースで区切って文字数を数えているのです。

日本語はそういう区切りが無いので、文字を切り出して表示してくれません。なのでこのファンクションを修正しました。

「はい」をデフォルトに

| コメント(0)
「価格お問い合わせ商品」は「はい」をデフォルトに。

/public_html/admin/includes/modules/product_xxx/collect_info.php

default: $in_product_is_call = false; $out_product_is_call = true;

を以下に変更

default: $in_product_is_call = true; $out_product_is_call = false;


ところで扇風機買わなきゃ

ここにモジュールがあります。
自分でやらなくてはいけなかったら大変だったと思います。。。

http://www.zen-cart.com/index.php?main_page=product_contrib_info&cPath=40_62&products_id=77

開発してくださった方に感謝!
/public_html/includes/templates/template/templates/tpl_index_default.php に書けばトップだけに表示されます。

以下はSQLサンプル。

<?php



$languages_id = $_SESSION['languages_id'];

$sql = "SELECT a.categories_name, a.categories_id FROM " . TABLE_CATEGORIES_DESCRIPTION
. " a, " . TABLE_CATEGORIES . " b WHERE a.categories_id = b.categories_id
and a.feature_flg = 1 and a.language_id =" . $languages_id . " and b.parent_id
= 18;";

$dbdata = $db->Execute($sql);

while (!$dbdata->EOF) {

echo "<p><a href=¥"http://www.sample.com/index.php?main_page=index&cPath=11_18_".$dbdata->fields['categories_id']
."¥">" . $dbdata->fields['categories_name'] . "</a></p>";

$dbdata->MoveNext();

}

?>
/public_html/includes/templates/template/common/tpl_main_page.php

トップページだけにイメージを表示したい場合、パンくずリストの設定を真似るとカンタンです。

ただし、管理画面で、レイアウトの設定→パン屑リストの設定で「2」(トップのみパンくずリスト非表示)を選びます。

if (DEFINE_BREADCRUMB_STATUS == '1' || (DEFINE_BREADCRUMB_STATUS == '2' && !$this_is_home_page) ){
ここはトップ以外で表示
}
else {
ここはトップのみに表示される

}
zen cartデフォルトだと、なぜかお問合せへのリンクがSSLになっていません。

修正は
/public_html/includes/modules/sideboxes/information.phpの

if (DEFINE_CONTACT_US_STATUS <= 1) {

$information[] = '<a href="' . zen_href_link(FILENAME_CONTACT_US) . '">'
. BOX_INFORMATION_CONTACT . '</a>';

}

を以下に変更。

if (DEFINE_CONTACT_US_STATUS <= 1) {

$information[] = '<a href="' . zen_href_link(FILENAME_CONTACT_US, '',
'SSL') . '">' . BOX_INFORMATION_CONTACT . '</a>';

}

/public_html/includes/templates/template/common/tpl_main_page.php にtpl_header.phpの内容を移動させた。

商品詳細の画像

| コメント(0)
/public_html/includes/templates/template/templates/tpl_modules_main_product_image.phpを修正。

商品情報の追加

| コメント(0)
1.テーブル新規
CREATE TABLE product_art_extra (
products_id int(11) NOT NULL default '0',
size varchar(32) default NULL,
frame_h int(11) default NULL,
frame_w int(11) default NULL,
frame_d int(11) default NULL,
window_h int(11) default NULL,
window_w int(11) default NULL,
window_d int(11) default NULL,
accessories varchar(96) default NULL,
PRIMARY KEY (products_id)
) TYPE=MyISAM;

2.追加SQL
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_ART_INFO_ACCESSORIES', '1',
'附帯品を表示する 0=表示しない 1=表示する', '6', '3',
'zen_cfg_select_drop_down(array(array(¥'id¥'=>¥'1¥', ¥'text¥'=>¥'True¥'), array(¥'id¥'=>¥'0¥', ¥'text¥'=>¥'False¥')), ', now());

3. admin/includes/extra_datafiles/art_type_database_names.phpを新規追加。

define('TABLE_PRODUCT_ART_EXTRA', DB_PREFIX . 'product_art_extra');

4.includes/extra_datafiles/art_type_database_names.phpを新規追加。

define('TABLE_PRODUCT_ART_EXTRA', DB_PREFIX . 'product_art_extra');

5.admin/includes/modules/product_artのcollect_info.php
データ取得
$art = $db->Execute("select size, frame_h, frame_w, frame_d, window_h, window_w, window_d, accessories
from " . TABLE_PRODUCT_ART_EXTRA .
" where products_id = '" . (int)$_GET['pID']. "'");

と、表示部分



fields['accessories']); ?>

以下省略

6.admin/includes/modules/update_product.phpをコピー。
admin/includes/modules/product_art/update_product.phpとする。

update_product.phpのこんな風に書いてある箇所に、
///////////////////////////////////////////////////////
//// INSERT PRODUCT-TYPE-SPECIFIC *INSERTS* HERE //////


//// *END OF PRODUCT-TYPE-SPECIFIC INSERTS* ////////
///////////////////////////////////////////////////////
$sql_data_array = array('products_id' => $products_id,
'accessories' => zen_db_prepare_input($_POST['accessories']),
'size' => zen_db_prepare_input($_POST['size']) );

zen_db_perform(TABLE_PRODUCT_ART_EXTRA, $sql_data_array);

を入れる。

次に、
///////////////////////////////////////////////////////
//// INSERT PRODUCT-TYPE-SPECIFIC *UPDATES* HERE //////


//// *END OF PRODUCT-TYPE-SPECIFIC UPDATES* ////////
///////////////////////////////////////////////////////

の間に、
$sql_data_array = array('accessories' => zen_db_prepare_input($_POST['accessories']),
'size' => zen_db_prepare_input($_POST['size']));
zen_db_perform(TABLE_PRODUCT_BOOK_EXTRA,
$sql_data_array,
'update',
"products_id = '" . (int)$products_id . "'");
を入れる。

7.admin/includes/modules/product_art/delete_product_confirm.php を
/public_html/admin/includes/modules/product_art配下にコピー。

PRODUCT_TYPE_SPECIFIC_INSTRUCTIONS_GO__BELOW_HEREの部分に以下を追加。

$db->Execute("delete from " . TABLE_PRODUCT_ART_EXTRA . "
where products_id = '" . (int)$product_id . "'");

8./public_html/admin/includes/modules/copy_to_confirm.phpを
/public_html/admin/includes/modules/product_art配下にコピー。

$dup_products_id = $db->Insert_ID();の下に
$book_extra = $db->Execute("select authers, size, publish_date from " .
TABLE_PRODUCT_BOOK_EXTRA .
" where products_id = '" .
(int)$products_id . "'");

$db->Execute("insert into " . TABLE_PRODUCT_BOOK_EXTRA . "
(products_id, authers, size, publish_date)
values (
'" . (int)$dup_products_id . "',
'" . zen_db_input($book_extra->fields['authers']) . "',
'" . zen_db_input($book_extra->fields['size']) . "',
'" . zen_db_input($book_extra->fields['publish_date']) . "')");
と追加。

9.admin/product_art.phpに追加

10. includes/modules/pages/product_art_info/main_template_vars.phpに

$sql = "select * from " . TABLE_PRODUCT_ART_EXTRA . "
where products_id = '" . (int)$_GET['products_id'] . "'";
$art_extras = $db->Execute($sql);
$art_accessories = $art_extras->fields['accessories'];
$art_size = $art_extras->fields['size'];
$art_frame_h = $art_extras->fields['frame_h'];
$art_frame_w = $art_extras->fields['frame_w'];
$art_frame_d = $art_extras->fields['frame_d'];
$art_window_h = $art_extras->fields['window_h'];
$art_window_w = $art_extras->fields['window_w'];
$art_window_d = $art_extras->fields['window_d'];
 を追加。

$flag_show_art_product_info_accessories =
zen_get_show_product_switch($_GET['products_id'], 'accessories');
$flag_show_art_product_info_size =
zen_get_show_product_switch($_GET['products_id'], 'size');
$flag_show_art_product_info_frame_h =
zen_get_show_product_switch($_GET['products_id'], 'frame_h');
$flag_show_art_product_info_frame_w =
zen_get_show_product_switch($_GET['products_id'], 'frame_w');
$flag_show_art_product_info_frame_d =
zen_get_show_product_switch($_GET['products_id'], 'frame_d');
$flag_show_art_product_info_window_h =
zen_get_show_product_switch($_GET['products_id'], 'window_h');
$flag_show_art_product_info_window_w =
zen_get_show_product_switch($_GET['products_id'], 'window_w');
$flag_show_art_product_info_window_d =
zen_get_show_product_switch($_GET['products_id'], 'window_d');
 を追加。

12.includes/languages/japanese/product_art_info.php
に追加。

define('TEXT_PRODUCT_ACCESSORIES', '附帯品: ');
define('TEXT_PRODUCT_SIZE', 'サイズ: ');
define('TEXT_PRODUCT_FRAME', '額寸(縦×横×厚み): ');
define('TEXT_PRODUCT_WINDOW', '窓寸(縦×横): ');

13./public_html/includes/templates/template/templates/tpl_product_art_info_display.phpに追加。

' . TEXT_PRODUCT_SIZE . $art_size . '' : '') . "¥n"; ?>
' . TEXT_PRODUCT_FRAME . $art_frame_h . '×'. $art_frame_w . '×'. $art_frame_d .'cm' : '') . "¥n"; ?>
' . TEXT_PRODUCT_WINDOW . $art_window_h . '×'. $art_window_w .'cm' : '') . "¥n"; ?>
' . TEXT_PRODUCT_MODEL . $products_model . '' : '') . "¥n"; ?>
' . TEXT_PRODUCT_ACCESSORIES . $art_accessories . '' : '') . "¥n"; ?>

ほわわ。。。大変。

ところでワタクシ

こんにちは、久保明子です。フリーランスでweb制作の仕事をしています。印刷関係担当の相棒と二人でwebarton(ウェバートン)という名称で働いてます。
サイトはこちらです。http://www.webarton.com/

それから、フェアトレードのショッピングサイトも運営していて、オーガニック&ハンドメイドのソープやボディケア商品を扱っています。お取引くださるお店募集中です!
http://fairtradeshopping.jp/


このアーカイブについて

このページには、過去に書かれたブログ記事のうちzen cartカテゴリに属しているものが含まれています。

前のカテゴリはXOOPSです。

次のカテゴリはたまにはここでごはん。です。

最近のコンテンツはインデックスページで見られます。過去に書かれたものはアーカイブのページで見られます。