Jan Zonjee Posted November 9, 2008 Share Posted November 9, 2008 Does this piece of code make loading a little slower and perhaps sometimes make it not load at all? // BOF Separate Pricing per Customer, Price Break 1.11.3 mod $pf->[b]loadProductSppc[/b]((int)$HTTP_GET_VARS['products_id'], (int)$languages_id, $product_info); $products_price = $pf->getPriceString(); // EOF Separate Pricing per Customer, Price Break 1.11.3 mod The idea was not to do the same queries again for PriceFormatter but hand the results of the queries to PriceFormatter.php in this way. No clue as to why the table is not loaded, never seen it happen myself. The new version is almost ready though (but I haven't looked at upgrade instructions) :) Has some nice new functionality like a dropdown if you have a lot of price breaks, min order quantity functionality. Anyway, will take some time because I need to check the install instructions now, make diffs, some more screenshots...) Quote Link to comment Share on other sites More sharing options...
shotputty Posted November 10, 2008 Share Posted November 10, 2008 (edited) I found a little clue to why the priceformatter table is not loading. I can recreate this problem by logging in, logging off, and then clicking on any product. On first sight there is no table. On pagerefresh it's loaded. So what I did is echo some variables to see what they are at the time the problem occurs. This is what happens: $sppc_customer_group_id ---> EMPTY! $_SESSION[sppc_customer_group_id] ---> 0 On page refresh (and the table comes up): $sppc_customer_group_id ---> 0 $_SESSION[sppc_customer_group_id] ---> 0 I fixed this in application_top.php by making $sppc_customer_group_id take on the value of $_SESSION[sppc_customer_group_id] and it works. This piece of code in product_info.php, shouldn't it do something with the $sppc_customer_group_id if the session isn't registered yet? // BOF Separate Price per Customer if(!tep_session_is_registered('sppc_customer_group_id')) { $customer_group_id = '0'; } else { $customer_group_id = $sppc_customer_group_id; } Anyway, happy I found the clue. This is one of the best MODs I've seen! EDIT: This is what I added at the bottom of application_top.php before the last ?> $sppc_customer_group_id = $_SESSION['sppc_customer_group_id'] ; Edited November 10, 2008 by shotputty Quote Link to comment Share on other sites More sharing options...
Zappo Posted November 10, 2008 Share Posted November 10, 2008 Just revisited this contribution because of an osC update, and I see there have been some descent (dB) changes since version 1.2!!! I just don't see what all the Database tables are for... Could someone explain what these tables are for: - products_group_(x) (auto generated - Which doesn't seem to happen with my store) - specials_retail_prices (Which doesn't seem to hold data with my store) Seems to me, all data can be (or even IS) stored in the existing "products_groups" and "specials" tables... Am I missing something? Quote Like Eek said... It never hurts to help!---------------------------------------- Link to comment Share on other sites More sharing options...
Zappo Posted November 10, 2008 Share Posted November 10, 2008 (edited) Forgot to mention, both those tables seem to only be used/accessed from index.php and advanced_search_result.php Seems to me, there should be no reason all data can't be stored in products_groups and specials tables: Why add a "products_group_" table for every group, when all that data can be stored in "products_groups" Why add a "specials_retail_prices" table, when "specials" contains all columns needed to store the data? I'm planning to add QPBPP (just like I had with my previous osC installation), but I really want to use both contribution's latest versions. Simplifying the tables of SPPC should make these a lot easier to merge... Thanks for any comments! Edited November 10, 2008 by Zappo Quote Like Eek said... It never hurts to help!---------------------------------------- Link to comment Share on other sites More sharing options...
Jan Zonjee Posted November 10, 2008 Share Posted November 10, 2008 Forgot to mention, both those tables seem to only be used/accessed from index.php and advanced_search_result.phpSeems to me, there should be no reason all data can't be stored in products_groups and specials tables: Why add a "products_group_" table for every group, when all that data can be stored in "products_groups" Why add a "specials_retail_prices" table, when "specials" contains all columns needed to store the data? I'm planning to add QPBPP (just like I had with my previous osC installation), but I really want to use both contribution's latest versions. Simplifying the tables of SPPC should make these a lot easier to merge... These tables (as is mentioned in the install file I think) are only used when there a sorting/selection is needed on price in index.php or advanced_search_result.php. This could be done in heap files but not all MySQL installations provided that (need to be specially allowed by the hoster) so instead I chose to use these temporary tables. They don't hold any data you should be concerned about updating. It derives it data from products_groups and specials. Nowadays it probably could be done using subselects but then you need a minimum version of MySQL 4.1. At the time this was written this version was either brand new or not there yet. Quote Link to comment Share on other sites More sharing options...
Zappo Posted November 10, 2008 Share Posted November 10, 2008 These tables (as is mentioned in the install file I think) are only used when there a sorting/selection is needed on price in index.php or advanced_search_result.php. This could be done in heap files but not all MySQL installations provided that (need to be specially allowed by the hoster) so instead I chose to use these temporary tables. They don't hold any data you should be concerned about updating. It derives it data from products_groups and specials. Nowadays it probably could be done using subselects but then you need a minimum version of MySQL 4.1. At the time this was written this version was either brand new or not there yet. Thanx Jan! That clears up everything. I think I'll be removing the tables, and change everything to use the products_groups and specials tables... I'll have to see if I have time to make those changes into an update (As I haven't seen a server with a MySQL version < 4 in quite some time...) Maybe (If I'm pleased with my results, if Jan doesn't beat me to it, and again if time permits it) I'll even make an update to QPBPP for SPPC. (How's that coming, Jan?) P.S. Geez... You DID mention this in the install file... My bad... Quote Like Eek said... It never hurts to help!---------------------------------------- Link to comment Share on other sites More sharing options...
Jan Zonjee Posted November 10, 2008 Share Posted November 10, 2008 Maybe (If I'm pleased with my results, if Jan doesn't beat me to it, and again if time permits it) I'll even make an update to QPBPP for SPPC. (How's that coming, Jan?) I will surely beat you with that. Code is ready, install instructions are ready but need to be tested to see if I didn't miss anything. So let's say it's 95% finished. Perhaps you want to take the "unfinished" product and test install it yourself to see whether I missed something or not :lol: Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted November 10, 2008 Share Posted November 10, 2008 Anyway, happy I found the clue. I did change it in later versions of SPPC to: // BOF Separate Pricing per Customer 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'; } // EOF Separate Pricing per Customer The $sppc_customers_group_id probably only worked in the good old days when register globals was still on :) Glad you found the problem spot. With the new version of QPBPP I wouldn't have gone back to that old version for fixing. Quote Link to comment Share on other sites More sharing options...
Zappo Posted November 10, 2008 Share Posted November 10, 2008 Perhaps you want to take the "unfinished" product and test install it yourself to see whether I missed something or not :lol: Cool, I'd like that. Why wouldn't you place it on the contributions page as a beta? It's not like a contribution is supposed to be bug-free ;) Quote Like Eek said... It never hurts to help!---------------------------------------- Link to comment Share on other sites More sharing options...
Jan Zonjee Posted November 10, 2008 Share Posted November 10, 2008 Why wouldn't you place it on the contributions page as a beta? It took me a lot of time to write this so a bit more time to make sure the install is correct and the only bugs left the one I overlooked is in order IMHO. But if you want to help in that process than I can email you what is ready.. tomorrow or so. Quote Link to comment Share on other sites More sharing options...
Zappo Posted November 10, 2008 Share Posted November 10, 2008 It took me a lot of time to write this so a bit more time to make sure the install is correct and the only bugs left the one I overlooked is in order IMHO. But if you want to help in that process than I can email you what is ready.. tomorrow or so. Yeah sure, no problem, Please do. I have a totally clean installation setup and running (2.2rc2a) so that 'll make for good testing... Just send me whatever you have, and I'll comment on or add to that. Quote Like Eek said... It never hurts to help!---------------------------------------- Link to comment Share on other sites More sharing options...
UncleSteve Posted November 11, 2008 Share Posted November 11, 2008 Is there a way to display the default price and the SPPC price in the product description, or perhaps to have an icon displayed when a special price is displayed! Or is there any other feature available like my idea? Thanks in advance :) Quote ____________________________________________________________________ ____________________________________________________________________ Link to comment Share on other sites More sharing options...
Jan Zonjee Posted November 11, 2008 Share Posted November 11, 2008 Is there a way to display the default price and the SPPC price in the product description Something like this post? (previous page, first post). The products description itself cannot contain PHP (not completely true but it is far from easy and taxing on the server I understand). Quote Link to comment Share on other sites More sharing options...
UncleSteve Posted November 12, 2008 Share Posted November 12, 2008 Something like this post? (previous page, first post). The products description itself cannot contain PHP (not completely true but it is far from easy and taxing on the server I understand). Hi Jan, Thanks for your prompt reply. Unfortunately my coding ability is not up to the way you have presented your answer, sorry (I'm a copy and paste coder), plus my site is heavily modified, so line numbers are way out. Would you have time to modify the code below (subject to me pasting the correct bit) to show the retail price please? Thanks in advance for your time and efforts Steve $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id, p.minorder, p.vendors_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); //<!-- sam - code here for extra field to display phone number 2 --> $product_info = tep_db_fetch_array($product_info_query); $alt_tag = TEXT_ML; //added by sam $vendor_query = tep_db_query(" select vendors_phone2 from " . TABLE_VENDORS . " where vendors_id = '" . (int)$product_info['vendors_id'] . "'"); $vendor = tep_db_fetch_array($vendor_query); $free_shipping = $vendor['vendors_phone2']; //<!-- sam - end of code here for extra field to display phone number 2 --> tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'"); if ($new_price = tep_get_products_special_price($product_info['products_id'])) { // BOF Separate Pricing per Customer if ($customer_group_id > 0) { // only need to check products_groups if customer is not retail $scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id']. "' and customers_group_id = '" . $customer_group_id . "'"); if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) { $product_info['products_price']= $scustomer_group_price['customers_group_price']; } } // end if ($customer_group_id > 0) // EOF Separate Pricing per Customer $products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>'; } else { // BOF Separate Pricing per Customer if ($customer_group_id > 0) { // only need to check products_groups if customer is not retail $scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id']. "' and customers_group_id = '" . $customer_group_id . "'"); if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) { $product_info['products_price']= $scustomer_group_price['customers_group_price']; } } // end if ($customer_group_id > 0) // EOF Separate Pricing per Customer $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])); } if (tep_not_null($product_info['products_model'])) { $products_name = $product_info['products_name'] . '<br><span class="smallText"><font color="#000000">[Order Code:' . $product_info['products_model'] . ']</font></span>'; } else { $products_name = $product_info['products_name']; } ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading" valign="top"><?php echo $products_name; ?><BR> </td> <td class="pageHeading" align="center" valign="top"><?php echo $products_price; ?> <br> Quote ____________________________________________________________________ ____________________________________________________________________ Link to comment Share on other sites More sharing options...
Guest Posted November 13, 2008 Share Posted November 13, 2008 Having a problem with SPPC 4.2, when I log in, i get Fatal error: Call to undefined method shoppingCart::get_customer_group_id() in ../order/includes/classes/shopping_cart.php on line 32 but if i delete the url back to ../order and refresh, I'm logged in... any ideas?? this is killing me... Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted November 13, 2008 Share Posted November 13, 2008 Having a problem with SPPC 4.2, when I log in, i get Fatal error: Call to undefined method shoppingCart::get_customer_group_id() in ../order/includes/classes/shopping_cart.php on line 32 but if i delete the url back to ../order and refresh, I'm logged in... any ideas?? this is killing me... Then that function is not added to includes/classes/shopping_cart.php (or outside the last ?>). Quote Link to comment Share on other sites More sharing options...
Guest Posted November 15, 2008 Share Posted November 15, 2008 Hi Folks, Question: I have SPPC installed and Hide Products from customers on top. I have done it on the original RC2a shop and it works great. In my actual webshop though which is heavily modified I tried to include it several times checking all the files again and again. The problem is always the same: When I mark an Item invisible for retail customers, no other customer group can see it either (e.g. reseller) As far as I understood it the $customer_group_id ='2'; must be set for the item to be visible 1= retail 2= reseller If I set it manually in the index.php file the item shows up ----------------- around line: // BOF Separate Pricing Per Customer if(!tep_session_is_registered('customer_group_id')) { $customer_group_id = '1'; } else { $customer_group_id = $sppc_customer_group_id; } $customer_group_id ='2'; // her I set it to 2 manually // this will build the table with specials prices for the retail group or update it if needed // this function should have been added to includes/functions/database.php if ($customer_group_id == '0') { tep_db_check_age_specials_retail_table(); } $status_product_prices_table = false; $status_need_to_get_prices = false; -------------------- but that doesn´t help much, it must b e somwhere deeper in the code, because if i click "add to basket" the Item is not added. The right column shows the number of items excluding the invisible item, another hint that the prg doesn´t know abot the item batteries (1) - should be batteries (2) Everything in the admin section works, I can see that the database is updated ok with the $customer_group_id. I would be thankful for any hint. best regards Morton :) Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted November 15, 2008 Share Posted November 15, 2008 // BOF Separate Pricing Per Customer if(!tep_session_is_registered('customer_group_id')) { $customer_group_id = '1'; } else { $customer_group_id = $sppc_customer_group_id; } This relies on register_globals = on. You should use: $customer_group_id = $_SESSION['sppc_customer_group_id']; instead. Quote Link to comment Share on other sites More sharing options...
DimeNote Posted November 17, 2008 Share Posted November 17, 2008 Hello, Just wondering if this contribution can be made to work along with "Customer List Improved"? To clarify, would it be possible to only add the "RA" and "Customer Group" headings and info into the layout of Customer List Improved or are all the mods in the admin/customers.php file required? If this has already been covered I apologize as I could not find any mention throughout this thread. If it is possible, would someone be so kind and lead me in the proper direction? Thanks again. Quote Link to comment Share on other sites More sharing options...
bluewaterbob Posted November 17, 2008 Share Posted November 17, 2008 I just installed the latest osCommerce, 2.2rc2a, and everything installed without a problem: demo products displayed, and admin worked. I then installed Separate Pricing 4.2.1, the July 20th 2008 version. I uploaded all the files in the new install/catalog folder, then opened phpmyAdmin, imported/ran the new install sql file, again no problem. I then went to log back into the admin and I get a HTTP 500 Internal Server Error when I use IE, and I get a blank page when I use Firefox. The url is http://icllabs.com/catalog/admin Has anyone come across this and have an idea where I can look? (Also, you'll see in catalog/index.php I'm still getting the error to change catalog/includes/configure.php, but I've changed it to 644, then to 444 and still getting the error. However, the admin not displaying is my biggest problem) Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted November 17, 2008 Share Posted November 17, 2008 Just wondering if this contribution can be made to work along with "Customer List Improved"? To clarify, would it be possible to only add the "RA" and "Customer Group" headings and info into the layout of Customer List Improved or are all the mods in the admin/customers.php file required? I'm not aware of it being discussed earlier. I've heard about Customer List Improved but never looked at it. The admin/customers.php is already adapted from a modded file (addon #223, customer_sort_admin_v1). There is an added nicety that counts the number of customers per group but that is not a necessity. It does however contains a number of features only found in SPPC like settings for allowed payment and shipping modules per customer (those for the group are set in customer groups) plus the setting for RA (you could do without that) and you would definitely need the modifications to change a customer to another customer group. I don't know how "Customer List Improved: compares to this mod, feature wise, to know if you would loose a lot using the one for SPPC. Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted November 17, 2008 Share Posted November 17, 2008 I just installed the latest osCommerce, 2.2rc2a, and everything installed without a problem: demo products displayed, and admin worked. I then installed Separate Pricing 4.2.1, the July 20th 2008 version. I uploaded all the files in the new install/catalog folder, then opened phpmyAdmin, imported/ran the new install sql file, again no problem. I then went to log back into the admin and I get a HTTP 500 Internal Server Error when I use IE, and I get a blank page when I use Firefox. The url is http://icllabs.com/catalog/admin Has anyone come across this and have an idea where I can look? (Also, you'll see in catalog/index.php I'm still getting the error to change catalog/includes/configure.php, but I've changed it to 644, then to 444 and still getting the error. However, the admin not displaying is my biggest problem) From the path to the configure.php I would guess you are on a Windows server so settings like 644 don't make sense in a Windows environment. Don't know the equivalent Windows wording of that (read only?). Not a clue why these files cause a 500 error (Firefox doesn't show that but when I use curl I do see a 500 error so that is browser independent). Try to find an error log. Without knowing what the exact error is this is quite impossible to fix. There are no known issues with this version, apart from admin/customers_groups.php that uses the wrong path to the location of the up and down arrows (a good one is in "Hide products from customer groups for SPPC"). Quote Link to comment Share on other sites More sharing options...
Zappo Posted November 17, 2008 Share Posted November 17, 2008 From the path to the configure.php I would guess you are on a Windows server so settings like 644 don't make sense in a Windows environment. Don't know the equivalent Windows wording of that (read only?). I'm running wamp (Windows - Apache PHP MySQL) which is an offline (localhost) server for testing and building applications), and setting the file to 'read only' is actually the way to go for wamp... Online I'm on Linux, so don't know about that... Quote Like Eek said... It never hurts to help!---------------------------------------- Link to comment Share on other sites More sharing options...
DimeNote Posted November 17, 2008 Share Posted November 17, 2008 I'm not aware of it being discussed earlier. I've heard about Customer List Improved but never looked at it. The admin/customers.php is already adapted from a modded file (addon #223, customer_sort_admin_v1). There is an added nicety that counts the number of customers per group but that is not a necessity. It does however contains a number of features only found in SPPC like settings for allowed payment and shipping modules per customer (those for the group are set in customer groups) plus the setting for RA (you could do without that) and you would definitely need the modifications to change a customer to another customer group. I don't know how "Customer List Improved: compares to this mod, feature wise, to know if you would loose a lot using the one for SPPC. Jan, Thank you for the response. I like the appearance and the layout of the Customers List Improved contribution and that is why I was wondering if these two would merge well or not. This does not seem to be the case. I will have to abandon the Customers List Improved contribution for this one as I need the SPPC functionality. Thanks again. Quote Link to comment Share on other sites More sharing options...
bluewaterbob Posted November 18, 2008 Share Posted November 18, 2008 I just installed the latest osCommerce, 2.2rc2a, and everything installed without a problem: demo products displayed, and admin worked. I then installed Separate Pricing 4.2.1, the July 20th 2008 version. I uploaded all the files in the new install/catalog folder, then opened phpmyAdmin, imported/ran the new install sql file, again no problem. I then went to log back into the admin and I get a HTTP 500 Internal Server Error when I use IE, and I get a blank page when I use Firefox. The url is http://icllabs.com/catalog/admin Has anyone come across this and have an idea where I can look? ----------------------------- I found the problem (of not displaying admin) by adding these 2 lines to the bottom of my .htaccess file located in the admin folder: php_flag display_errors on php_value error_reporting 7 It displayed the php errors which showed one of my configure.php files was set to 444, I changed it to 644 and problem went away, but the store still gives the error listed below. I'll let my server support people figure that one out. (Also, you'll see in catalog/index.php I'm still getting the error to change catalog/includes/configure.php, but I've changed it to 644, then to 444 and still getting the error. However, the admin not displaying is my biggest problem) Quote Link to comment Share on other sites More sharing options...
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.