ahuizotl Posted September 23, 2009 Report Share Posted September 23, 2009 hallo, es sieht nicht so schön aus wenn in den produktempfehlungen der gleiche artikel mehrfach auftaucht (z.b. ein mal in rot, in grün etc.), deshalb: kann man die slaveartikel aus dem cross selling heraus nehmen? dankbar für tipps, barry Link to comment Share on other sites More sharing options...
oldbear Posted September 23, 2009 Report Share Posted September 23, 2009 hi, lt. class im Plugin holt er sich die Daten aus der xt_orders_products über die product-id - da steht aber nix über M/S drin. Man könnte die Tabelle erweitern und schon beim wegschreiben ein Flag setzen, das man dann später abfragt ( sau-aufwändig ) oder die class so erweitern, dass er dort schon die Slaves rausschmeisst. Was für PHPler. Grüsse Ergänzung: Dann werden die Verkäufe von Master-Artikeln aber auch nicht mehr angezeigt .... Link to comment Share on other sites More sharing options...
ahuizotl Posted September 24, 2009 Author Report Share Posted September 24, 2009 habe die class.auto_cross_sell.php angepasst: function getAutoCrossSellProductListing($products_id='') { global $xtPlugin, $xtLink, $db; $products_id = (int)$products_id; if ($products_id=='') return false; /*added code*/ //$quer = "SELECT products_id, products_master_model FROM ".TABLE_PRODUCTS." WHERE products_master_model!=''"; //$resus = $db->CacheExecute($quer); /*added end*/ $query = "SELECT bop.products_id FROM ".TABLE_ORDERS_PRODUCTS." aop, ".TABLE_ORDERS_PRODUCTS." bop WHERE aop.products_id='".$products_id."' and aop.products_id!=bop.products_id and aop.orders_id = bop.orders_id group by bop.products_id"; $rs = $db->CacheExecute($query); if ($rs->RecordCount()==0) return false; $products = array(); /*added code*/ $record = $db->Execute("SELECT products_id FROM ".TABLE_PRODUCTS." WHERE products_master_model != ''"); $data=array(); if($record->RecordCount() > 0){ while(!$record->EOF){ $data[] = $record->fields['products_id']; $record->MoveNext(); } } /*added end*/ while (!$rs->EOF) { $products[] = $rs->fields['products_id']; $rs->MoveNext(); } /*added code*/ $out=array(); foreach($products as $v){ if(in_array($v, $data)){ $master=array(); $masterid=array(); $rec = $db->Execute("SELECT products_master_model FROM ".TABLE_PRODUCTS." WHERE products_id = '".$v."'"); if($rec->RecordCount() > 0){ //echo "ja"; while(!$rec->EOF){ $master[] = $rec->fields['products_master_model']; $rec->MoveNext(); } $rec = $db->Execute("SELECT products_id FROM ".TABLE_PRODUCTS." WHERE products_model = '".$master[0]."'"); if($rec->RecordCount() > 0){ while(!$rec->EOF){ $masterid[] = $rec->fields['products_id']; $rec->MoveNext(); } if(!in_array($masterid[0], $out)) $out[] = $masterid[0]; } } }else $out[]=$v; } $products=$out; /*added end*/ // shuffle if more than max if (XT_ALSO_PURCHASED_MAX_DISPLAY<$rs->RecordCount()) { shuffle($products); $products = array_slice($products, 0,XT_AUTO_CROSS_SELL_MAX_DISPLAY); } $module_content = array(); $inmodcont=array(); $size = 'default'; foreach ($products as $key => $val) { $product = & new product($val,$size); if ($product->is_product){ $module_content[] = $product->data; } } return $module_content; } /** * auto cross selling for shopping cart display * */ function getAutoCrossSellProductListingCart() { global $xtPlugin, $xtLink, $db; if (count($_SESSION['cart']->content)<1) return false; $ids = array(); foreach ($_SESSION['cart']->content as $key => $val) { $ids[]=$val['products_id']; } $query = "SELECT bop.products_id FROM ".TABLE_ORDERS_PRODUCTS." aop, ".TABLE_ORDERS_PRODUCTS." bop WHERE aop.products_id IN (".implode(',',$ids).") and aop.products_id!=bop.products_id and aop.orders_id = bop.orders_id group by bop.products_id"; $rs = $db->CacheExecute($query); if ($rs->RecordCount()==0) return false; $products = array(); /*added code*/ $record = $db->Execute("SELECT products_id FROM ".TABLE_PRODUCTS." WHERE products_master_model != ''"); $data=array(); if($record->RecordCount() > 0){ while(!$record->EOF){ $data[] = $record->fields['products_id']; $record->MoveNext(); } } /*added end*/ while (!$rs->EOF) { if (!in_array($rs->fields['products_id'],$ids)) $products[] = $rs->fields['products_id']; $rs->MoveNext(); } /*added code*/ $out=array(); foreach($products as $v){ if(in_array($v, $data)){ $master=array(); $masterid=array(); $rec = $db->Execute("SELECT products_master_model FROM ".TABLE_PRODUCTS." WHERE products_id = '".$v."'"); if($rec->RecordCount() > 0){ //echo "ja"; while(!$rec->EOF){ $master[] = $rec->fields['products_master_model']; $rec->MoveNext(); } $rec = $db->Execute("SELECT products_id FROM ".TABLE_PRODUCTS." WHERE products_model = '".$master[0]."'"); if($rec->RecordCount() > 0){ while(!$rec->EOF){ $masterid[] = $rec->fields['products_id']; $rec->MoveNext(); } if(!in_array($masterid[0], $out)) $out[] = $masterid[0]; } } }else $out[]=$v; } $products=$out; /*added end*/ // shuffle if more than max if (XT_ALSO_PURCHASED_MAX_DISPLAY<$rs->RecordCount()) { shuffle($products); $products = array_slice($products, 0,XT_AUTO_CROSS_SELL_MAX_DISPLAY); } $module_content = array(); foreach ($products as $key => $val) { $size = 'default'; $product = & new product($val,$size); if ($product->is_product) $module_content[] = $product->data; } return $module_content; } Link to comment Share on other sites More sharing options...
ahuizotl Posted September 24, 2009 Author Report Share Posted September 24, 2009 ...und entsprechend in der class.cross_selling.php function getCrossSellingProductListing($products_id) { global $xtPlugin, $xtLink, $db; $products_id = (int)$products_id; if ($products_id=='') return false; $this->sql_products->setPosition('cross_selling'); $this->sql_products->setSQL_TABLE("INNER JOIN " . TABLE_PRODUCTS_CROSS_SELL . " pc ON p.products_id = pc.products_id_cross_sell"); $this->sql_products->setSQL_WHERE("and pc.products_id ='".$products_id."'"); $this->sql_products->setSQL_WHERE("and pc.products_id_cross_sell=p.products_id"); $query = $this->sql_products->getSQL_query(); $rs = $db->CacheExecute($query); if ($rs->RecordCount()==0) return false; $cross_sell_products = array(); /*added code*/ $record = $db->Execute("SELECT products_id FROM ".TABLE_PRODUCTS." WHERE products_master_model != ''"); $data=array(); if($record->RecordCount() > 0){ while(!$record->EOF){ $data[] = $record->fields['products_id']; $record->MoveNext(); } } /*added end*/ while (!$rs->EOF) { $cross_sell_products[] = $rs->fields['products_id']; $rs->MoveNext(); } /*added code*/ $out=array(); foreach($cross_sell_products as $v){ if(in_array($v, $data)){ $master=array(); $masterid=array(); $rec = $db->Execute("SELECT products_master_model FROM ".TABLE_PRODUCTS." WHERE products_id = '".$v."'"); if($rec->RecordCount() > 0){ //echo "ja"; while(!$rec->EOF){ $master[] = $rec->fields['products_master_model']; $rec->MoveNext(); } $rec = $db->Execute("SELECT products_id FROM ".TABLE_PRODUCTS." WHERE products_model = '".$master[0]."'"); if($rec->RecordCount() > 0){ while(!$rec->EOF){ $masterid[] = $rec->fields['products_id']; $rec->MoveNext(); } if(!in_array($masterid[0], $out)) $out[] = $masterid[0]; } } }else $out[]=$v; } $products=$out; /*added end*/ // shuffle if more than max if (XT_CROSS_SELLING_MAX_DISPLAY<$rs->RecordCount()) { shuffle($cross_sell_products); $cross_sell_products = array_slice($cross_sell_products, 0,XT_CROSS_SELLING_MAX_DISPLAY); } $module_content = array(); foreach ($cross_sell_products as $key => $val) { $size = 'default'; $product = & new product($val,$size); $module_content[] = $product->data; } return $module_content; } ...ich glaube, das ist gar nicht nötig, denn man kann ohnehin im cross-selling keine slaveartikel als ziel wählen. Link to comment Share on other sites More sharing options...
oldbear Posted September 24, 2009 Report Share Posted September 24, 2009 hi, azuihotl, wie bringst Du das SOLVED in den Titel ? Würde gerne ein paar ältere Sachen "bereinigen" Grüsse oldbear Link to comment Share on other sites More sharing options...
GoriBoy Posted September 24, 2009 Report Share Posted September 24, 2009 hi, azuihotl, wie bringst Du das SOLVED in den Titel ? Würde gerne ein paar ältere Sachen "bereinigen" Grüsse oldbear würde ich auch mal gerne wissen.. Gruß GoriBoy Link to comment Share on other sites More sharing options...
amilo Posted September 24, 2009 Report Share Posted September 24, 2009 Wenn du der Threadersteller bist, kannst du doch einfach den Titel ändern. MfG. Hansen Link to comment Share on other sites More sharing options...
ahuizotl Posted September 25, 2009 Author Report Share Posted September 25, 2009 was? habe ich diesen thread zu unrecht als solved markiert? ich habe ihn doch angefangen. was heisst solved überhaupt? doch, dass alle sehen können, dass es hier eine lösung gibt, oder kann man den thread dann nicht mehr finden? sorry, dass ich hier was beitrage, echt. Link to comment Share on other sites More sharing options...
GoriBoy Posted September 25, 2009 Report Share Posted September 25, 2009 doch mann, ist schon in ordnung.. wir woltlen nur wissen wie man dieses [sOLVED] einbaut, mehr net.. mach dir keine sorgen.. gruß GoriBoy Link to comment Share on other sites More sharing options...
ahuizotl Posted September 30, 2009 Author Report Share Posted September 30, 2009 ...peace... Link to comment Share on other sites More sharing options...
svenhaig Posted September 8, 2011 Report Share Posted September 8, 2011 Vielen Dank für diese Lösung. Schade eigentlich, dass sie nicht zum Standardprogramm gehört. Das wäre einer der vielen Wünsche für eine nächste Version. Aber im Großen und Ganzen bin ich mit xtcommerce 4 Veyton zufrieden. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.