Goerg Posted October 20, 2009 Posted October 20, 2009 Hi I installed succesfully Separate Price per Customer 4.2 and it´s working ok. Now I want to add the Product Listing Enhancements and have problems to join both contributions specially in /include/modules/product_listing.php, because this file is quite different from the original one. I asked Sam, the creator of Product Listing, but he thinks I must do the modification in index.php. Has anyone has accomplished to install both modules? Jorge Quote
Guest Posted October 21, 2009 Posted October 21, 2009 Have the same problem as you so if you found a solution for it please post it here, will follow your thread. Quote
Guest Posted October 21, 2009 Posted October 21, 2009 I kept looking around and Sam had a solution that worked in an earlier thread, as he wrote there, in /include/modules/product_listing.php Find (293) while ($products = tep_db_fetch_array($listing_query)) { Replace with: $no_of_listings = tep_db_num_rows($listing_query); if(isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') { $customer_group_id = $_SESSION['sppc_customer_group_id']; } else { $customer_group_id = '0'; } while ($_listing = tep_db_fetch_array($listing_query)) { $listing[] = $_listing; $list_of_prdct_ids[] = $_listing['products_id']; } if ($customer_group_id != '0') { $pg_query = tep_db_query("select pg.products_id, customers_group_price as price from " . TABLE_PRODUCTS_GROUPS . " pg where products_id in (" . implode(',', $list_of_prdct_ids) . ") and pg.customers_group_id = '" . $customer_group_id . "'"); while ($pg_array = tep_db_fetch_array($pg_query)) { $new_prices[] = array ('products_id' => $pg_array['products_id'], 'products_price' => $pg_array['price'], 'specials_new_products_price' => '', 'final_price' => $pg_array['price']); } for ($x = 0; $x < $no_of_listings; $x++) { if(!empty($new_prices)) { for ($i = 0; $i < count($new_prices); $i++) { if( $listing[$x]['products_id'] == $new_prices[$i]['products_id'] ) { $listing[$x]['products_price'] = $new_prices[$i]['products_price']; $listing[$x]['final_price'] = $new_prices[$i]['final_price']; } } } // end if(!empty($new_prices) $listing[$x]['specials_new_products_price'] = ''; // makes sure that a retail specials price doesn't carry over to another customer group $listing[$x]['final_price'] = $listing[$x]['products_price']; // final price should not be the retail special price } } $specials_query = tep_db_query("select products_id, specials_new_products_price from " . TABLE_SPECIALS . " where products_id in (" . implode(',', $list_of_prdct_ids) . ") and status = '1' and customers_group_id = '" . $customer_group_id . "'"); while ($specials_array = tep_db_fetch_array($specials_query)) { $new_s_prices[] = array ('products_id' => $specials_array['products_id'], 'products_price' => '', 'specials_new_products_price' => $specials_array['specials_new_products_price'] , 'final_price' => $specials_array['specials_new_products_price']); } // add the correct specials_new_products_price and replace final_price for ($x = 0; $x < $no_of_listings; $x++) { if(!empty($new_s_prices)) { for ($i = 0; $i < count($new_s_prices); $i++) { if( $listing[$x]['products_id'] == $new_s_prices[$i]['products_id'] ) { $listing[$x]['specials_new_products_price'] = $new_s_prices[$i]['specials_new_products_price']; $listing[$x]['final_price'] = $new_s_prices[$i]['final_price']; } } } // end if(!empty($new_s_prices) } // end for ($x = 0; $x < $no_of_listings; $x++) reset($listing); while (list($key, $products) = each($listing)) { Give it a try... Quote
Goerg Posted October 22, 2009 Author Posted October 22, 2009 Hi Yicon I did a try without success. I guess the place to make the insert is right, not line 293 but 332 in current version. Yesterday I was trying to solve it all the day. I think that besides of doing this insert, changes must be done in other places, some 30 lines after this insert. I see the problem like this: In Separate Prices, the array is builded with: $listing[$x]['products_price'] where $x will be the different kind of clients list. The original one is $listing[$x]['products_price'] In Product Listing Enhancements Sam works with other array: $products['products_id'] So, besides of inserting the Separate Price code in Product Listing Enhancements, some modifications must be done in the arrays, maybe make $products['products_id'] = $listing[$x]['products_price'] in some part of the code. Perhaps Sam can help with it Jorge Quote
Goerg Posted October 22, 2009 Author Posted October 22, 2009 I wanted to say: $products['products_price'] = $listing[$x]['products_price'] in some part of the code. Jorge Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.