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

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

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

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

Добавлен: 16.02.2024

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

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

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

// 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" ;


$db_sku->setQuery( $q ) ;

$db_sku->query() ;

while( $db_sku->next_record() ) {

$q = "SELECT attribute_name, attribute_value, product_id " ;

$q .= "FROM #__{vm}_product_attribute WHERE " ;

$q .= "product_id='" . $db->f( "product_id" ) . "' AND " ;

$q .= "attribute_name='" . $db_sku->f( "attribute_name" ) . "'" ;

$db_item->setQuery( $q ) ;

$db_item->query() ;

while( $db_item->next_record() ) {

//$html .= $db_item->f( "attribute_name" ) . " " ;

$html .= $db_item->f( "attribute_value" ) ;

if( ! $db_sku->is_last_record() )

$html .= '; ' ;

}

}

*/

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

// Attributes for this item are done.

// Now get item price

if( $_SESSION['auth']['show_prices'] && _SHOW_PRICES ) {

$price = $ps_product->get_adjusted_attribute_price( $db->f( "product_id" ) ) ;

$price["product_price"] = $GLOBALS['CURRENCY']->convert( $price["product_price"], $price["product_currency"] ) ;

if( $_SESSION["auth"]["

show_price_including_tax"] == 1 ) {

$tax_rate = 1 + $ps_product->get_product_taxrate( $db->f( "product_id" ) ) ;

$price['product_price'] *= $tax_rate ;

}

$html .= ' - ' . $CURRENCY_DISPLAY->getFullValue( $price["product_price"] ) ;

}

$html .= "</option>\n" ;

}

$html .= "</select>\n" ;

$tpl->set( "drop_down", $html ) ;

} else {

$html = "<input type=\"hidden\" name=\"product_id\" value=\"$product_id\" />\n" ;

$html .= "<input type=\"hidden\" name=\"prod_id[]\" value=\"$product_id\" />\n" ;

$tpl->set( "drop_down", $html ) ;

}

$html = $tpl->fetch( 'product_details/includes/addtocart_drop.tpl.php' ) ;

return array( $html , "drop" ) ;

}

/**

* Lists all child/sister products of the given product

*

* @param int $product_id

* @return string HTML code with Items, attributes & price

*/

function list_attribute_drop_multi( $product_id, $cls_suffix ) {

global $VM_LANG, $CURRENCY_DISPLAY, $mm

_action_url, $sess ;

require_once (CLASSPATH . 'ps_product.php') ;

$ps_product = new ps_product( ) ;

$Itemid = $sess->getShopItemid() ;

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

$db = new ps_DB( ) ;

$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

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

$db->setQuery( $q ) ;

$db->query() ;

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

// Try to Get list of sisters & brothers

$q = "SELECT product_parent_id FROM #__{vm}_product WHERE product_id='$product_id'" ;

$db->setQuery( $q )