Archive for 10 月, 2009

zencart:プレビューに在庫数

Posted on 土曜日, 10 月 31st, 2009 at 7:15 PM

管理画面にて商品登録時プレビュー画面にも在庫数を表示させる。

/admin/includes/modules/product/preview_info.

 

<? echo $pInfo->products_quantity; ?>

関連記事

zencart:新着に入荷予定非表示

Posted on 土曜日, 10 月 31st, 2009 at 12:08 PM

 TOPページのランダムで入れ替わる新着リストに

入荷予定品を非表示に。

/includes/modules/テンプレート/new_products.

p.products_date_available,

where p.products_status = 1 and (p.products_date_available < now())  ". $display_limit;

とかでいいのかな。

とりあえず非表示になった^^ ん~ ちょっと足りないようだ

p.products_status = 1 and ( (p.products_date_available = NULL) or (p.products_date_available  < p.products_date_added) or (p.products_date_available < now()) ) ". $display_limit

とか?w

and (  (p.products_date_available = NULL) or (p.products_date_added < now()) or (p.products_date_available  < p.products_date_added) or (p.products_date_available < now()) ) 

かな

p.products_status = 1 and (  (p.products_date_added < now()) or (p.products_date_available  > p.products_date_added) or (p.products_date_available < now())) 

かもw

--------

新着一覧は・・・

/includes/modules/pages/products_new/header_php.

関連記事

zencart:入荷予定時刻設定

Posted on 月曜日, 10 月 26th, 2009 at 6:41 PM

date_format(p.products_date_available, '%Y-%m-%d') as

date_format(p.products_date_available, '%Y-%m-%d %H:%i:%s') as

<td class="main"><script language="javascript">dateAvailable.writeControl(); dateAvailable.dateFormat="yyyy-MM-dd";</script></td>

<td class="main"><script language="javascript">dateAvailable.writeControl(); dateAvailable.dateFormat="yyyy-MM-dd 00:00:00";</script></td>

---
if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
  $expected_query = "select p.products_id, pd.products_name, products_date_available as date_expected
                       from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
                       where to_days(products_date_available) > to_days(now())
                       and p.products_id = pd.products_id
                       and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
                       order by " . EXPECTED_PRODUCTS_FIELD . " " . EXPECTED_PRODUCTS_SORT . "
                       limit " . MAX_DISPLAY_UPCOMING_PRODUCTS;
} else {
Read the rest of this entry »

関連記事

zencart:入荷予定にメーカー名を

Posted on 月曜日, 10 月 26th, 2009 at 5:57 PM

入荷予定(未発売品)その2(upcoming_products_s2)リストにメーカー名を表示するように

/includes/templates/template_default/upcoming_products_s2.

にデフォルトのupcoming_products.こコピーして置く。

その後はオーバーライドで。ページ増設する。

includes/filenames.

/includes/templates/テンプレート/templates/tpl_modules_upcoming_products_s2.

/includes/templates/テンプレート/templates/tpl_upcoming_list_s2_default.

/includes/languages/japanese/テンプレート/upcoming_list_s2.

/includes/modules/pages/upcoming_list_s2

/includes/modules/upcoming_products_s2.

その2でなく通常の入荷予定を修正するのなら以下の部分のみで おk かな

---------

/includes/modules/upcoming_products_s2.

 

if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
  $expected_query = "select p.products_id, pd.products_name, products_date_available as date_expected , p.products_model,p.products_tax_class_id,m.manufacturers_name
                       from " . TABLE_PRODUCTS . " p
 LEFT JOIN " . TABLE_MANUFACTURERS . " m
                             ON (p.manufacturers_id = m.manufacturers_id)

, " . TABLE_PRODUCTS_DESCRIPTION . " pd
                       where to_days(products_date_available) > to_days(now())
                       and p.products_id = pd.products_id
                       and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
                       order by " . EXPECTED_PRODUCTS_FIELD . " " . EXPECTED_PRODUCTS_SORT . "
                       limit " . MAX_DISPLAY_UPCOMING_PRODUCTS;
} else {
  $expected_query = "select p.products_id, pd.products_name, products_date_available as date_expected, p.products_model,p.products_tax_class_id,m.manufacturers_name
                       from " . TABLE_PRODUCTS . " p
 LEFT JOIN " . TABLE_MANUFACTURERS . " m
                             ON (p.manufacturers_id = m.manufacturers_id)

, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " .
  TABLE_CATEGORIES . " c
                       where p.products_id = p2c.products_id
                       and p2c.categories_id = c.categories_id
                       and c.parent_id = '" . (int)$new_products_category_id . "'
                       and to_days(products_date_available) > to_days(now())
                       and p.products_id = pd.products_id
                       and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
                       order by " . EXPECTED_PRODUCTS_FIELD . " " . EXPECTED_PRODUCTS_SORT . "
                       limit " . MAX_DISPLAY_UPCOMING_PRODUCTS;
}

------

/includes/templates/★★/templates/tpl_modules_upcoming_products_s2.

. $expected->fields['manufacturers_name']

関連記事

wordpress:monthchunks月刊アーカイブ

Posted on 土曜日, 10 月 24th, 2009 at 5:20 PM

wordpress:monthchunksを使って 月刊アーカイブを短くwする

monthchunks-2.1.zip をDLし あっぷ。プラグインON。

表示させたい場所に次を明記。

<? monthchunks(); ?>

-----------

新しい年を上に表示するよう変更しよう。monthchunks. 85行目辺り・・・かな

    // set SQL order by sort order
    if ($year_order == "descending")
    {
        $year_order = "DESC";
    }
    else
    {
        $year_order = "ASC";
    }

次のように変更

    // set SQL order by sort order
    if ($year_order == "descending")
    {
        $year_order = "ASC"; //"DESC";
    }
    else
    {
        $year_order = "DESC";//"ASC";
    }

-----

入れ替えるだけw

関連記事

zencart:バグ

Posted on 月曜日, 10 月 19th, 2009 at 4:41 PM

いまさらのバグ修正w zen1.3.0.2

1062 Duplicate entry '234-2' for key 1
in:
[insert into products_description (products_name, products_description, products_url, products_id, language_id) values ('aaaa', 'bbb', '', '234', '2')]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

など、商品登録時にエラーが表示され そのまま戻ると 全然別の商品名で登録される。もしくは無関係の別の商品名でもう1つ登録される。型番が2個同じとか。

 

しかしこれで商品登録は正しくできたが、買い物時、配送が表示されない;;

--------

参考URL

http://zen-cart.jp/bbs/viewtopic.php?f=2&t=4200

------

// bof: categories meta tags
      case 'update_category_meta_tags':
      // add or update meta tags
      //die('I SEE ' . $action . ' - ' . $_POST['categories_id']);
      $categories_id = $_POST['categories_id'];
      if (zen_get_category_metatags_keywords($categories_id, (int)$_SESSION['languages_id']) or zen_get_category_metatags_description($categories_id, (int)$_SESSION['languages_id'])) {
        $action = 'update_category_meta_tags';
      } else {
        $action = 'insert_categories_meta_tags';
      }

      $languages = zen_get_languages();
      for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
        $language_id = $languages[$i]['id'];

        $sql_data_array = array('metatags_title' => zen_db_prepare_input($_POST['metatags_title'][$language_id]),
                                'metatags_keywords' => zen_db_prepare_input($_POST['metatags_keywords'][$language_id]),
                                'metatags_description' => zen_db_prepare_input($_POST['metatags_description'][$language_id]));

        if ($action == 'insert_categories_meta_tags') {
          $insert_sql_data = array('categories_id' => $categories_id,
                                   'language_id' => $language_id);

          $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

          zen_db_perform(TABLE_METATAGS_CATEGORIES_DESCRIPTION, $sql_data_array);
        } elseif ($action == 'update_category_meta_tags') {
          zen_db_perform(TABLE_METATAGS_CATEGORIES_DESCRIPTION, $sql_data_array, 'update', "categories_id = '" . (int)$categories_id . "' and language_id = '" . (int)$language_id . "'");
        }
      }

      zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories_id));
      break;
      // eof: categories meta tags
---------

を次のように

// bof: categories meta tags
      case 'update_category_meta_tags':
      // add or update meta tags
      //die('I SEE ' . $action . ' - ' . $_POST['categories_id']);
      $categories_id = $_POST['categories_id'];

/*
* バグ対応
*/

      $languages = zen_get_languages();
      for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
        $language_id = $languages[$i]['id'];

        $sql_data_array = array('metatags_title' => zen_db_prepare_input($_POST['metatags_title'][$language_id]),
                                'metatags_keywords' => zen_db_prepare_input($_POST['metatags_keywords'][$language_id]),
                                'metatags_description' => zen_db_prepare_input($_POST['metatags_description'][$language_id]));

      $check_sql_data_array = $db->Execute("select categories_id from ".TABLE_METATAGS_CATEGORIES_DESCRIPTION." where language_id = '".$language_id."' and categories_id = '".$categories_id."' ");
      $check_cat = $check_sql_data_array->fields['categories_id'];

      if($check_cat){
         $action = 'update_category_meta_tags';
      }else{
         $action = 'insert_categories_meta_tags';
      }
     
        if ($action == 'insert_categories_meta_tags') {
          $insert_sql_data = array('categories_id' => $categories_id,
                                   'language_id' => $language_id);

          $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

          zen_db_perform(TABLE_METATAGS_CATEGORIES_DESCRIPTION, $sql_data_array);
        } elseif ($action == 'update_category_meta_tags') {
          zen_db_perform(TABLE_METATAGS_CATEGORIES_DESCRIPTION, $sql_data_array, 'update', "categories_id = '" . (int)$categories_id . "' and language_id = '" . (int)$language_id . "'");
        }
      }

      zen_redirect(zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories_id));
      break;
      // eof: categories meta tags
--------

関連記事

zencart:納品書にメーカー名

Posted on 月曜日, 10 月 5th, 2009 at 2:22 PM

:納品書にメーカー名表示 

カスタマイズその1 納品書

今回は メーカー名を表示させる。

参考URL http://zen-cart.jp/bbs2/viewtopic.php?f=3&t=2523

参考URLそのまんまw

/admin/

納品書 invoice.

配送表 packingslip.

注文管理 orders.

-------------------

/includes/classes/order.にて定義する。

//

 function zen_get_products_manufacturers_name($product_id) {
    global $db;

    $product_query = "select m.manufacturers_name
                      from " . TABLE_PRODUCTS . " p, " .
                            TABLE_MANUFACTURERS . " m
                      where p.products_id = '" . (int)$product_id . "'
                      and p.manufacturers_id = m.manufacturers_id";

    $product =$db->Execute($product_query);

    return ($product->RecordCount() > 0) ? $product->fields['manufacturers_name'] : "";
  }

//

, products_id

//

,
                                        'products_id' => $orders_products->fields['products_id']);

//

-----------

/admin/invoice. (納品書) 赤字追加

zen_get_products_manufacturers_name($order->products[$i]['products_id']) //任意の場所に・・
例えば
           '        <td class="dataTableContent"  colspan="2" valign="top">'
. zen_get_products_manufacturers_name($order->products[$i]['products_id']) .'<br />' . $order->products[$i]['name'];

----------

注文Eメールにもメーカー名(青色追加)869行目

includes/classes/order.

      $this->products_ordered .=  $this->products[$i]['qty'] . ' x ' . ' (' . zen_get_products_manufacturers_name($this->products[$i]['id']) . ') '  . $this->products[$i]['name'] . ($this->products[$i]['model'] != '' ? ' (' . $this->products[$i]['model'] . ') ' : '') . ' = ' .

関連記事