Tomasz Dmuchowski

Tomasz Dmuchowski Growth Hacker ?
Tworzę strategie
pozyskiwania ruchu i
kon...

Temat: get_neighbor_products

Problem dotyczy funkcji get_neighbor_products w pliku ps_products.php

1* http://sklep.swisskiss.pl/index.php?page=shop.product_...

2* http://sklep.swisskiss.pl/index.php?page=shop.product_...

do tego etapu dodatkowa ścieżka produktów jest w tej samej kategorii, w kolejnym etapie

3* http://sklep.swisskiss.pl/index.php?page=shop.product_...

wchodzi do innej kategorii, a ma zostać w tej samej.

/**
* This function retrieves the "neighbor" products of a product specified by $product_id
* Neighbors are the previous and next product in the current list
*
* @param int $product_id
* @return array
*/
function get_neighbor_products( $product_id ) {
global $perm, $orderby, $my, $auth, $keyword, $DescOrderBy, $limit, $limitstart, $search_limiter, $search_op,
$category_id, $manufacturer_id, $vm_mainframe, $vmInputFilter, $product_type_id, $keyword1, $keyword2;
$limit = 2000;
$limitstart = 0;
if( !empty( $_SESSION['last_browse_parameters'])) {
foreach( $_SESSION['last_browse_parameters'] as $paramName => $paramValue ) {
$$paramName = $paramValue;
}
}
$db = new ps_DB();
$db_browse = new ps_DB();
if (defined('VM_ALLOW_EXTENDED_CLASSES') && defined('VM_THEMEPATH') && VM_ALLOW_EXTENDED_CLASSES && file_exists(VM_THEMEPATH.'user_class/shop_browse_queries.php')) {
// Load the user-defined shop_browse_queries file
include_once(VM_THEMEPATH.'user_class/shop_browse_queries.php');
} else {
// Otherwise we have to use the original file
include( PAGEPATH . 'shop_browse_queries.php' );
}
$db->query( $list );
$neighbors = array('previous'=>'',
'next'=>'');
while( $db->next_record() ) {
if( $db->f( 'product_id' ) == $product_id ) {
$previous_row = $db->previousRow();
$next_row = $db->nextRow();
if( !empty( $previous_row->product_id )) {
$neighbors['previous']['product_id'] = $previous_row->product_id;
$neighbors['previous']['product_name'] = $previous_row->product_name;
}
if( !empty( $next_row->product_id )) {
$neighbors['next']['product_id'] = $next_row->product_id;
$neighbors['next']['product_name'] = $next_row->product_name;
}
}
}
return $neighbors;
}
/**



Obrazek


plik shop.produkt_details:

// Get the neighbor Products to allow navigation on product level
$neighbors = $ps_product->get_neighbor_products( !empty( $product_parent_id ) ? $product_parent_id : $product_id );
$next_product = $neighbors['next'];
$previous_product = $neighbors['previous'];
$next_product_url = $previous_product_url = '';
if( !empty($next_product) ) {
$url_parameters = 'page=shop.product_details&product_id='.$next_product['product_id'].'&flypage='.$ps_product->get_flypage($next_product['product_id']).'&pop='.$pop;
if( $manufacturer_id ) {
$url_parameters .= "&manufacturer_id=" . $manufacturer_id;
}
if( $keyword != '') {
$url_parameters .= "&keyword=".urlencode($keyword);
}
if( $pop == 1 ) {
$next_product_url = $sess->url( $_SERVER['PHP_SELF'].'?'.$url_parameters );
} else {
$next_product_url = str_replace("index2","index",$sess->url( $url_parameters ));
}
}
if( !empty($previous_product) ) {
$url_parameters = 'page=shop.product_details&product_id='.$previous_product['product_id'].'&flypage='.$ps_product->get_flypage($previous_product['product_id']).'&pop='.$pop;
if( $manufacturer_id ) {
$url_parameters .= "&manufacturer_id=" . $manufacturer_id;
}
if( $keyword != '') {
$url_parameters .= "&keyword=".urlencode($keyword);
}
if( $pop == 1 ) {
$previous_product_url = $sess->url( $_SERVER['PHP_SELF'].'?'.$url_parameters );
} else {
$previous_product_url = str_replace("index2","index",$sess->url( $url_parameters ));
}
}
Tomasz Dmuchowski edytował(a) ten post dnia 07.02.12 o godzinie 12:57
Tomasz Wylandowski

Tomasz Wylandowski Właściciel, Ekspert
CRM

Temat: get_neighbor_products

Witaj,

podajesz bezpośrednie linki, a na stronie brak włączonej opcji "pokaż sąsiadów".

Ciężko stwierdzić co nie działa...

Przynajmniej dla mnie :)
Tomasz Dmuchowski

Tomasz Dmuchowski Growth Hacker ?
Tworzę strategie
pozyskiwania ruchu i
kon...

Temat: get_neighbor_products

ponieważ wczoraj wyłączyłem ten parametr i kombinuję ... już aktywny i widoczny

Następna dyskusja:

get_neighbor_products




Wyślij zaproszenie do