Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

Hello, I have installed "hide_products_and_categories_v203" for hide products to some groups and there is a problem in products_new.php.

 

The changes are:

Line 57

**REPLACE**

 $products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name";

**WITH**

// BOF Separate Pricing Per Customer, hide products and categories from groups

  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';
  }

 $products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) left join " . TABLE_CATEGORIES . " c using(categories_id) where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 and find_in_set('" . $customer_group_id . "', categories_hide_from_groups) = 0 order by p.products_date_added DESC, pd.products_name";
// EOF Separate Pricing Per Customer, hide products and categories from groups

 

The only problem is in the query, is that products that are copied to other categories (not cloned, but have instances in other categories) are repeated in the list!

 

You can see this: http://www.modeltronic.es/products_new.php, for example you can see a brushless engine repeated 3 times, more below, the 62054 wheels repeated 4 times!

 

Can you help me? I'm spanish-spoken, so sorry by my english.

Link to comment
Share on other sites

The only problem is in the query, is that products that are copied to other categories (not cloned, but have instances in other categories) are repeated in the list!

Interesting. I saw that in a version on my computer I have $products_new_query_raw = "select distinct p.products_id, etcetera. Perhaps that helps...

Link to comment
Share on other sites

Hello, I have installed "hide_products_and_categories_v203" for hide products to some groups and there is a problem in products_new.php.

 

The changes are:

Line 57

**REPLACE**

 $products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name";

**WITH**

// BOF Separate Pricing Per Customer, hide products and categories from groups

  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';
  }

 $products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) left join " . TABLE_CATEGORIES . " c using(categories_id) where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 and find_in_set('" . $customer_group_id . "', categories_hide_from_groups) = 0 order by p.products_date_added DESC, pd.products_name";
// EOF Separate Pricing Per Customer, hide products and categories from groups

 

The only problem is in the query, is that products that are copied to other categories (not cloned, but have instances in other categories) are repeated in the list!

 

You can see this: http://www.modeltronic.es/products_new.php, for example you can see a brushless engine repeated 3 times, more below, the 62054 wheels repeated 4 times!

 

Can you help me? I'm spanish-spoken, so sorry by my english.

 

Still not working...

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*) as total from products p left join manufacturers m on (p.manufacturers_id = ' at line 1

 

select count(distinct *) as total from products p left join manufacturers m on (p.manufacturers_id = m.manufacturers_id), products_description pd left join products_to_categories p2c using(products_id) left join categories c using(categories_id) where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '3' and find_in_set('0', products_hide_from_groups) = 0 and find_in_set('0', categories_hide_from_groups) = 0

Edited by trikinuke
Link to comment
Share on other sites

Still not working...

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '*) as total from products p left join manufacturers m on (p.manufacturers_id = ' at line 1

 

select count(distinct *) as total from products p left join manufacturers m on (p.manufacturers_id = m.manufacturers_id), products_description pd left join products_to_categories p2c using(products_id) left join categories c using(categories_id) where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '3' and find_in_set('0', products_hide_from_groups) = 0 and find_in_set('0', categories_hide_from_groups) = 0

I remembered vaguely there was an issue with it but couldn't remember what the trick was to solve it. Found it now. The thing that solves it is adding a third variable to the call of the class split_products.php (next line after the "query line") so that you get count(distinct products_id) instead of distinct *:

 

$products_new_split = new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW, 'products_id');

Link to comment
Share on other sites

Have been tested a lot of combinations and nothing.

 

select p.products_id, ...

... new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW, 'products_id');
________________________________________________________________________________________________
select p.products_id, ...

... new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW, products_id);
________________________________________________________________________________________________
select distinct p.products_id, ...

... new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW);
________________________________________________________________________________________________
select distinct p.products_id, ...

... new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW, 'products_id');
________________________________________________________________________________________________
select distinct p.products_id, ...

... new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW, products_id);
________________________________________________________________________________________________
select distinct* p.products_id, ...

... new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW);
________________________________________________________________________________________________
select distinct * p.products_id, ...

... new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW);
________________________________________________________________________________________________
select distinct* p.products_id, ...

... new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW, 'products_id');

 

How is possible no one else had the same problem?

Edited by trikinuke
Link to comment
Share on other sites

Meaning what?

 

This contribution is used by hundreds of developers and I imagine if every people has the same problem, I think so, because I think that I have followed the steps properly (correctly), cos' the changes in this php file is only these few lines, very easy, very quickly, in comparisson with for eg. admin/categories, which has a lot of code lines modified.

 

I wonder if the rest of developers have realized that instances are repeated.

 

Jan, I tried with your code but it still drop a SQL error. Have you an alternative? Thank you.

 

Regards.

Link to comment
Share on other sites

This contribution is used by hundreds of developers and I imagine if every people has the same problem, I think so, because I think that I have followed the steps properly (correctly), cos' the changes in this php file is only these few lines, very easy, very quickly, in comparisson with for eg. admin/categories, which has a lot of code lines modified.

Your problem is most likely caused by the fact that you have the same product in several categories. Not everyone does that.

 

Jan, I tried with your code but it still drop a SQL error.

 

I accidently dropped my crystal ball and it broke in a thousand pieces. The mind-reading course I ordered had hasn't arrived either and still it would need a lot of practice I think.

 

Knowing exactly what the problem/error is paramount.

 

P.S. I should mention that I have trouble testing this because the "hide products" version of the shop was made on an osC version that needed register globals on and I have now transferred it to a computer that runs on register globals off. So basically nothing is working very well on this "hide products" shop.

Edited by Jan Zonjee
Link to comment
Share on other sites

Knowing exactly what the problem/error is paramount.

I remembered I can change the php.ini myself :) and I could verify that my suggestion works without causing errors (in my test site) in products_new.php:

 

 $products_new_query_raw = "select distinct p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) left join " . TABLE_CATEGORIES . " c using(categories_id) where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 and find_in_set('" . $customer_group_id . "', categories_hide_from_groups) = 0 order by p.products_date_added DESC, pd.products_name";
 // EOF Separate Pricing Per Customer, hide products and categories from groups
 $products_new_split = new splitPageResults($products_new_query_raw, MAX_DISPLAY_PRODUCTS_NEW, 'p.products_id');

Link to comment
Share on other sites

Suddenly it works!

 

Have copied your last quoted code and all ok. Tested hidding some item, it dissapears, then logging as a member for a specific group and it becomes public.

 

Thank you very much.

 

Some things you told me I didn't understand, due to my level of english.

 

accidently dropped my crystal ball and it broke in a thousand pieces. The mind-reading course I ordered had hasn't arrived either and still it would need a lot of practice I think.

 

paramount.

 

By the way, the work isn't still finished, now I have to expand your code to modules like featured products and DHTML categories (the categories box in the left column, which is not the original from OsCo as you know). It would be a good idea creating a new version of your great addon, dealing some modules from other famous contribs. If I get it, I will share these codes.

 

Best regards.

Link to comment
Share on other sites

Hello Jan,

 

Thanks as always for a great contribution. We are upgrading all our sites to the new rc2a versions. I just wanted to make sure before copying files over, that you upload from from July 20, 2008, version 4.2.2 is compatible for file copy over, or do I need to do a file comparison?

 

Thanks JR

Link to comment
Share on other sites

Hi again,

 

Jan: thank you for sending over the SPPC & Master Products MS2 files to get the two contributions working nicely with each other. SPPC now properly works with the slave products, but I have a new costmetic problem that I'm not sure is SPPC or Master products, so I'll try posting here first as the other thread is a bit dead (sadly).

 

The new code that I installed replaced the item input fields with a pull down menu. I made the changes to the code, and now I am receiving an input field that is quite large and says "Array" inside. I'd prefer it said the number 0! You can see an example on our test site here: http://www.alchemyindustrial.net/product_info.php?cPath=881_148_762&products_id=12897

 

Does anyone out there know how to fix this? Also, I am wondering how to get it to accept a 5 digit number rather than just 2. Currently maxes out a 99, but we are an industrial sales site and need 5 digit product ordering. Sorry if I am in the wrong place for this, but combining SPPC was the last step I did so I'm giving it a shot. I'll include the code in hopes that it will garner some insight.

 

  case 'MASTER_LIST_BUY_NOW': 

           $lc_align = 'center'; 
           $lc_valign = 'top';
           if ((STOCK_CHECK == 'true')&&(tep_get_products_stock($listing[$x]['products_id']) < 1)) { 
             $lc_text = TEXT_STOCK;
           } elseif ((STOCK_CHECK == 'false')&&(tep_get_products_stock($listing[$x]['products_id']) < 1)) {
             $qty_array = array();
             for ($i=0; $ns = 20, $i <= $ns; $i++) {
               $qty_array[] = array('id' => $i, 'text' => $i); 

               $lc_text = tep_draw_input_field('Qty_ProdId_' . $listing[$x]['products_id'], $qty_array) ;
                     //replaced tep_draw_pull_down_menu 
             }
           } else {
             $quantity = tep_get_products_stock($listing[$x]['products_id']);  
             $qty_array = array();
             for ($i=0; $ns = (($quantity < 20) ? $quantity : 20), $i <= $ns; $i++) {
               $qty_array[] = array('id' => $i, 'text' => $i); 

               $lc_text = tep_draw_input_field('Qty_ProdId_' . $listing[$x]['products_id'], $qty_array) ;

             } 
           }
             break;

 

Best,

 

Matt

Link to comment
Share on other sites

Hi there,

 

Ive just installed sppc and the price break contribution along with it. For some reason I am getting the following error everytime I go and edit a product and all the details regarding that product are not displayed:

 

Warning: reset() [function.reset]: Passed variable is not an array or object in /home/...../public_html/admin/includes/classes/object_info.php on line 17

 

Warning: Variable passed to each() is not an array or object in /home/...../public_html/admin/includes/classes/object_info.php on line 18

 

Any ideas?

 

Thanks for any help in advance. :)

Link to comment
Share on other sites

I have installed SPPC 4.2.2. Thanks for the contribution and it works OK with few issues

When I click customers in Admin, I get below link for every customer link. As I have 40 customers per page, I get 40 such links and clicking each of this link selects the customers which are listed below

 

// BOF customer_sort_admin_v1 adapted for Separate Pricing Per Customer

 

At the same time, I can click each of the customer links as well. How to avoid the above link which is duplicated to each of the customer links.

 

Other than that I am able to test with seperate group and able to see seperate pricing and could checkout w/o issues.

 

I am looking at support how to integrate SPPC with Order editor as when I add products manually, it shows retail price instead of the group pricing for that customer and order id.

 

Thanks

Link to comment
Share on other sites

Hi Jan

 

Using SPPC and quick updates - want to know let say I have created a group called "Product cost" - is there a way to update the other groups in a percentage way according to the group "Product cost"?

 

So if "Product cost" group 3 pricing then update group 0(retail)per percentage and group 1(trade) per percentage

If not it would be nice to display all tree groups next to each other with a percentage markup per group at top

 

Any ideas will be wonderful

 

Thanks Jan

Getting the Phoenix off the ground

Link to comment
Share on other sites

Hello,

 

Need a little help wit modules/product_listing.php. Trying to use the below code to remove the buy it now button if inventory is zero. I know I am missing something simple, but with the below code get NON_ONLINE_ITEM on all listings in product_listings, not just the items with zero inventory?

 

case 'PRODUCT_LIST_BUY_NOW':

$lc_align = 'center';

if ( $listing[$x]['products_quantity'] > 0 ){

$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';

}else{

$lc_text = NON_ONLINE_ITEM;

}

break;

 

 

Thanks JR

Link to comment
Share on other sites

Trying to use the below code to remove the buy it now button if inventory is zero.

I assume that in the query on index.php the products_quantity is not queried for (looks like it is only added to the query when you add the column product_quantity to the list of columns to show in the admin).

Link to comment
Share on other sites

  • 3 weeks later...

I have installed sppc and works fine EXCEPT that i do not get an email advising me that a customer (a store) needs to be included from admin in the commerce category of customers.

 

i know it can be done.- i have it installed on another web store.- but cannot find how i did it.

 

 

thanks

Link to comment
Share on other sites

Hi all,

 

I've had this mod installed for a while and everything had been working fine until we began noticing that when trying to view or edit customers in the admin who have been addeed since the mod was installed we get errors trying to access these particular customers... customers that existed before the mod was added are still accessible with no errors.

 

I've tracked the problem down to the cusotmers_info table on the DB under the field customers_info_stores_id

 

All new customers that have been added since the mod was installed have customers_info_stores_id of between "1" and "10", these are the customers which show an error. Customers with customers_info_stores_id of "NULL" are working fine and show all details when viewing their customer details in the admin.

 

I've found a fix for the error on another thread which is to do with an array problem in object_info.php on line 17 and 18 and the fix is:

 

In Admin customers.php, Find these lines:

 

$customer_info = array_merge($country, $info, $reviews);

 

$cInfo_array = array_merge($customers, $customer_info);

 

 

and change them to:

 

$customer_info = array_merge((array)$country, (array)$info, (array)$reviews);

 

$cInfo_array = array_merge((array)$customers, (array)$customer_info);

 

This fix didnt work for me to get the details displaying again probably because the fix has nothing to do with this mod or the customers_info_stores_id table.

 

A fix in object_info.php which involves the following code change:

 

Add:

 if (!is_array($object_array)) return;

Directly Under:
   function objectInfo($object_array) {

 

This code suppresses the following error in admin when trying to view a customer:

 

Warning: reset() [function.reset]: Passed variable is not an array or object in /catalog/admin/includes/classes/object_info.php on line 17

Warning: Variable passed to each() is not an array or object in /catalog/admin/includes/classes/object_info.php on line 18

 

However, it doesnt solve the problem of letting you view the customers details. The customers details still end up being blank but it just doesnt show an error anymore now.

 

So, how would i add customers_info_stores_id to the query in admin/customers.php in order to solve this problem of not being able to view customers details in the admin? or does anyone have any other ideas?

We have our customers tables split up into separate tables for each store but left the customers_info table the same for all stores which could be a problem. I wonder would splitting this table up be the answer?

 

Thanks for any help!

Link to comment
Share on other sites

Hi folks,

 

I have one Problem with the add-on.

 

When I define certain payment modules in the Admin (customers_groups.php) to exclude for example PayPal for our wholesale group I'll get a Fatal error: Cannot redeclare class moneyorder in /var/www/vhosts/vitaminvertrieb.com/httpdocs/includes/modules/payment/moneyorder.php on line 13.

 

With standard settings (every payment module allowed) all is fine.

 

Any ideas where to search for the bug?

 

Thanks,

 

Michael

Link to comment
Share on other sites

Hi all

 

I have just started to experience an issue with SPPC after it working really well for a while now. When I edit a product n my catalogue and then save it, the Products Price (Net) & Products Price (Gross) remain, however all of my group pricing disappears. This has just started happening and I have no idea as to why?

 

If I however upload my pricing using Easy populate all is god, at least until I go in and just edit an individual item, which loses all of my group pricing.

 

This is a real pain as sometimes I do only need to edit or add one item rather than upload an entire file.

 

If anyone has any ideas it would be most appreciated.

 

Thanks

 

Richard

Link to comment
Share on other sites

Hello,

 

Strange issue happening. For some reason, in admin customers, when I choose a customer group, I can not get option subscribe to take effect. After saving, option subscribe defaults back to unsubscribe. For some reason, it is not writing option to database?

 

Thanks JR

Link to comment
Share on other sites

Hi,

 

I have this add-on and it works really well-am very happy with.

 

Only bug I can find--and really annoys--is that company and names (first and surname) don't display the full name, even though the field is long enough on form and there is plenty of room in the column as displayed in admin ("Bendigo Wholefoods" is complete on SQL table and in Admin record, but I simply can't getit to display fully here. Any ideas greatly appreciated--a little thing but it's driving me nuts!

 

I've worked through /admin/customers.php and been able to change the column widths, but this does not change the text displayed.

 

Capture.JPG

 

 

 

 

Thanks

Edited by hfinlay10
Link to comment
Share on other sites

Only bug I can find--and really annoys--is that company and names (first and surname) don't display the full name

Actually, it is not a bug - it is a feature :)

 

The length that is displayed is hardcoded in the admin/customers.php file (see around line 1218 - example for entry company):

 


// BOF customer_sort_admin_v1 adapted for Separate Pricing Per Customer ?>
               <td class="dataTableContent"><?php
               if (strlen($customers['entry_company']) > 16 ) {
            print ("<acronym title=\"".$customers['entry_company']."\">".substr($customers['entry_company'], 0, 16)." </acronym>");
            } else {
               echo $customers['entry_company']; } ?></td>
               <td class="dataTableContent"><?php

 

If the length of the company name is larger than 16 characters it will show those 16 and the full name in a small popup when you hover over it with your mouse pointer (is implemented differently in different browsers, usually there is a small delay before popping-up the acronym text).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...