[Tep-j-general] Re: オプションを一括で登録したい。

Back to archive index

Frank Black frank_black****@hotma*****
2006年 2月 15日 (水) 00:27:50 JST


Frank Blackです。
解決済みでしたらすみません。

私はeasypopurate 2.61をカスタマイズして
オプションと特価商品を一括登録できるようにしています。
オプション部分の変更は以下のとおりです。

91行目付近
// **** Max Category Levels ****
// change this if you need more or fewer categories
global $max_categories;
$max_categories = 3; // 7 is default
の後に以下を挿入

// VJ product attributes begin
// **** Product Attributes ****
// change this to false, if do not want to download product attributes
global $products_with_attributes;
$products_with_attributes = true; 

// change this if you want to download selected product options
// this might be handy, if you have a lot of product options, and your 
output file exceeds 256 columns (which is the max. limit MS Excel is able 
to handle)
global $attribute_options_select;
//$attribute_options_select = array('Size', 'Model'); // uncomment and fill 
with product options name you wish to download // comment this line, if you 
wish to download all product options
// VJ product attributes end


156行目付近
//*******************************
// If you are running a pre-Nov1-2002 snapshot of OSC, then we need this 
include line to avoid
// errors like:
//   undefined function tep_get_uploaded_file
 if (!function_exists(tep_get_uploaded_file)){
	include ('easypopulate_functions.php');
 }
//*******************************
の後に以下を挿入

// VJ product attributes begin
global $attribute_options_array;
$attribute_options_array = array();

if ($products_with_attributes == true) {
	if (is_array($attribute_options_select) && 
(count($attribute_options_select) > 0)) {
		foreach ($attribute_options_select as $value) {
			$attribute_options_query = "select distinct products_options_id from " . 
TABLE_PRODUCTS_OPTIONS . " where products_options_name = '" . $value . "'";

			$attribute_options_values = tep_db_query($attribute_options_query);

			if ($attribute_options = tep_db_fetch_array($attribute_options_values)){
				$attribute_options_array[] = array('products_options_id' => 
$attribute_options['products_options_id']);
			}
		}
	} else {
		$attribute_options_query = "select distinct products_options_id from " . 
TABLE_PRODUCTS_OPTIONS . " order by products_options_id";

		$attribute_options_values = tep_db_query($attribute_options_query);

		while ($attribute_options = 
tep_db_fetch_array($attribute_options_values)){
			$attribute_options_array[] = array('products_options_id' => 
$attribute_options['products_options_id']);
		}
	}
}
// VJ product attributes end


1172行目付近
		$filelayout_sql = "SELECT
			p.products_id as v_products_id,
			p.products_model as v_products_model,
			p.products_image as v_products_image,
			p.products_price as v_products_price,
			p.products_weight as v_products_weight,
			p.products_date_added as v_date_avail,
			p.products_tax_class_id as v_tax_class_id,
			p.products_quantity as v_products_quantity,
			p.manufacturers_id as v_manufacturers_id,
			subc.categories_id as v_categories_id
			FROM
			products as p,
			categories as subc,
			products_to_categories as ptoc
			WHERE
			p.products_id = ptoc.products_id AND
			ptoc.categories_id = subc.categories_id
			";
		break;
に以下を挿入

// VJ product attributes begin
	case 'attrib':
		$iii = 0;
		$filelayout = array(
			'v_products_model'		=> $iii++
			);

    $header_array = array();

		$languages = tep_get_languages();

    global $attribute_options_array;

    $attribute_options_count = 1;
    foreach ($attribute_options_array as $attribute_options_values) {
			$key1 = 'v_attribute_options_id_' . $attribute_options_count;
			$header_array[$key1] = $iii++;

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

				$key2 = 'v_attribute_options_name_' . $attribute_options_count . '_' . 
$l_id;
				$header_array[$key2] = $iii++;
			}

			$attribute_values_query = "select products_options_values_id  from " . 
TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " where 
products_options_id = '" . 
(int)$attribute_options_values['products_options_id'] . "' order by 
products_options_values_id";

			$attribute_values_values = tep_db_query($attribute_values_query);

			$attribute_values_count = 1;
			while ($attribute_values = tep_db_fetch_array($attribute_values_values)) 
{
				$key3 = 'v_attribute_values_id_' . $attribute_options_count . '_' . 
$attribute_values_count;
				$header_array[$key3] = $iii++;

				$key4 = 'v_attribute_values_price_' . $attribute_options_count . '_' . 
$attribute_values_count;
				$header_array[$key4] = $iii++;

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

					$key5 = 'v_attribute_values_name_' . $attribute_options_count . '_' . 
$attribute_values_count . '_' . $l_id;
					$header_array[$key5] = $iii++;
				}

				$attribute_values_count++;
			}

			$attribute_options_count++;
    }

    $filelayout = array_merge($filelayout, $header_array);

		$filelayout_sql = "SELECT
			p.products_id as v_products_id,
			p.products_model as v_products_model
			FROM
			".TABLE_PRODUCTS." as p
			";

		break;
// VJ product attributes end


以上です。
では。




>From: 田中 一 <gals-****@hotma*****>
>Reply-To: tep-j****@lists*****
>To: tep-j****@lists*****
>Subject: [Tep-j-general] Re: オプションを一括で登録したい。
>Date: Tue, 14 Feb 2006 20:04:25 +0900
>
>はまだ様
>
>ご返信有難う御座います田中です。
>
>
> >ProductOptionsInProducsPageの設置方法は全部install.txtに書いてると思うん
> >ですが、具体的に「何が」解んないんでしょか?
> >
> >そう難しいことは書いてないと思うんすが…。
>
>すいません何度も見ておりますが手順がStep 1の時点から分かりません(^_^;)
>と言うより何て書いているかまったく分かりません。
>
>
> 
>http://lists.sourceforge.jp/mailman/archives/tep-j-general/2005-July/016158.html

>
> >
> >なんか以前にも同じような質問があって、↑こんな返事をして、そのまま流され
> >ちゃったことはあります(^_^;) あとどんな情報が必要ですか?
>
>
>過去ログを拝見させて頂いたのですが
> >当方が見たところ、工事手順は/admin/categories.phpに if
>(file_exists(DIR_WS_LANGUAGES(以下略
> >を追記
>
>これはadmin/categories.php内なら何処に追記しても宜しいのでしょうか?
>
>また、
> > <!-- products_attributes //-->
> > から<!-- products_attributes_eof //-->
> > までをどーんと追記する…といったものであるように思えます。
>
>こちらもadmin/categories.php内なら何処に追記しても宜しいのでしょうか?
>
>
>お手数をお掛け致しますがお手すきの際にでもご返信頂けると幸いです。
>
>
>
> >インストール出来ることは保証します。当方も使ってますんで。
> >
> > > 2、全ての商品に同じオプションを付けたいと思っております。
> >
> >全ての商品に同じオプションを追加すれば宜しいのでは?
> >
> >要するにproducts_attributesテーブルに
> >
> >・目的商品のproducts_id(A)
> >・追加したい属性のoptions_id(B)とoptions_values_id(C)
> >・(有れば)価格差(D)と価格に付ける接頭語(E)
> >
> >をINSERTするだけだと思いますんで、そうしたSQLを作成して実行されれば宜し
> >いのではないかと思うんですが?
> >
> > > INSERT into products_attributes (products_attributes_id, products_id,
>options_id, options_values_id, options_values_price, price_prefix)
>values(NULL, 'A', 'B', 'C', 'D' ,'E');
> >
> >A/B/C/D/Eの各値を実際のものに置き換えて実行してください。
> >
> >BやCが固定でAやDが変わるだけなら、むしろこうしたSQLをコピペして各個修正
> >→実行するみたいな手の方がラクだと思います。
> >
> >
> >はまだ
> >
> >_______________________________________________
> >Tep-j-general mailing list
> >Tep-j****@lists*****
> >http://lists.sourceforge.jp/mailman/listinfo/tep-j-general
>
>_________________________________________________________________
>パソコンでも携帯電話でも使える 「MSN Hotmail」
>http://promotion.msn.co.jp/hotmail/
>
>_______________________________________________
>Tep-j-general mailing list
>Tep-j****@lists*****
>http://lists.sourceforge.jp/mailman/listinfo/tep-j-general

_________________________________________________________________
MSNショッピングでXbox360を早速チェック! 
http://shopping.msn.co.jp/softcontent/softcontent.aspx?scmId=593 




Tep-j-general メーリングリストの案内
Back to archive index