Файл: Разработка мебельного интернет-магазина (Миссия компании).pdf

ВУЗ: Не указан

Категория: Курсовая работа

Дисциплина: Не указана

Добавлен: 28.03.2023

Просмотров: 1214

Скачиваний: 15

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

// AND p1.door_type!='$cur_door_type'

// and p1.door_color='$cur_door_color'

// " ;

$db->setQuery($q);

$db->query();

$db->next_record();

$new_id = $db->f( "product_id" );

if($new_id){

$product_parent_id=$cur_product_id;

$product_id=$new_id;

$_REQUEST['product_id']=$new_id;

$cur_product_id=$new_id;

}else{ // parent все же лучше уже здесь узнать:

$q="select product_parent_id from #__{vm}_product where product_id=$cur_product_id";

$db->setQuery($q);

$db->query();

$db->next_record();

$product_parent_id = $db->f( "product_parent_id" );

}

// echo">>>>>>>>>>>>>>>>>>>>>$cur_product_id - $new_id";

//if($product_id ==19)$product_id =23;

require_once (CLASSPATH . 'ps_product.php') ;

$ps_product = new ps_product( ) ;

$Itemid = $sess->getShopItemid() ;

$category_id = vmGet( $_REQUEST, 'category_id', "" ) ;

$db_sku = new ps_DB( ) ;

$db_item = new ps_DB( ) ;

$tpl = new $GLOBALS['VM_THEMECLASS']( ) ;

$tpl->set( "cls_suffix", $cls_suffix ) ;

$tpl->set( "product_id", $product_id ) ;

// Set Advanced Attributes

$tpl->set( "advanced_attribute", $this->list_advanced_attribute( $product_id, $db->f( "product_id" ) ) ) ;

$tpl->set( "custom_attribute", $this->list_custom_attribute( $product_id, $db->f( "product_id" ) ) ) ;

// Get list of children

$q1 = "";

if( CHECK_STOCK && PSHOP_SHOW_OUT_OF_STOCK_PRODUCTS != "1") {

$q1 = " AND product_in_stock > 0 ";

}

// $q = "SELECT product_id,product_name FROM #__{vm}_product WHERE product_parent_id='$product_id' AND product_publish='Y'" ;

//tra

veller:

$q="select door_color, door_type from #__{vm}_product_type_1 where product_id=$cur_product_id";

$db->setQuery($q);

$db->query();

$db->next_record();

$cur_door_type = $db->f( "door_type" );

$cur_door_color = $db->f( "door_color" );

//echo">>>>>>>>>>>>>>>>>> $product_parent_id - >>>$cur_product_id - $cur_door_type - $cur_door_color";

$q = "SELECT p.product_id,p.product_name FROM #__{vm}_product p

INNER JOIN #__{vm}_product_type_1 p1 on p1.product_id=p.product_id

WHERE p.product_parent_id='$product_parent_id' AND p.product_publish='Y'

AND p1.door_type!='$cur_door_type'

and p1.door_color='$cur_door_color'

" ;

$db->setQuery($q);

$db->query();

$db->next_record();

$alt_id=$d

}

}

$addhtml.="";

$q = "SELECT p.product_id,p.product_name FROM #__{vm}_product p

INNER JOIN #__{vm}_product_type_1 p1 on p1.product_id=p.product_id

WHERE p.product_parent_id='$product_parent_id' AND p.product_publish='Y'

AND p1.door_type='$cur_door_type'" ;

$db->query($q.$q1);

if( $db->num_rows() < 1 ) {

// Must be a child then

$child_id = $product_id;

// Try to Get list of sisters & brothers

$product_parent_id = $ps_product->get_field( $product_id, 'product_parent_id' ) ;

if( $product_parent_id != "0" ) {

$product_id = $product_parent_id;

// $q = "SELECT product_id,product_name FROM #__{vm}_product WHERE product_parent_id=$product_id AND product_parent_id<>0 AND product_publish='Y'" ;

//traveller:

$q = "SELECT p.product_id,p.product_name FROM #__{vm}_product p WHERE p.product_parent_id='$product

// Start row for this child

$html .= "<option value=\"" . $db->f( "product_id" ) . "\" $selected>" ;

///$html .= $db->f( "product_name" ) ." - " ;

$q="select door_color, door_type from #__{vm}_product_type_1 where product_id=".$db->f( "product_id" );

$db_sku->setQuery($q);

$db_sku->query();

$db_sku->next_record();

$html .=$db_sku->f( "door_color" ).", ".$db_sku->f( "door_type" );

/*

// For each child get attribute values by looping through attribute list

$q = "SELECT product_id, attribute_name FROM #__{vm}_product_attribute_sku " ;

$q .= "WHERE product_id='$product_id' ORDER BY attribute_list ASC" ;