[Tep-j-general] Re: EasyPopulateで一緒にオプションを登録する方法。

Back to archive index

山田 秀樹 skazi****@hotma*****
2006年 3月 10日 (金) 16:03:21 JST


はまだ様

申し訳ございません!肝心の変更した箇所を貼り付けるのを忘れておりました。

変更箇所はeasypopulate.phpの

259行目付近
// **** 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

を追記


327行目付近の
//*******************************
// 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

を追記


1188行目付近の
		$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

を追記です。


以上が当方が付した場所です。

お手数をおかけおかけいたしますが宜しくお願い致します。

山田

_________________________________________________________________
パソコンでも携帯電話でも使える 「MSN Hotmail」 
http://promotion.msn.co.jp/hotmail/ 




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