msasek Posted February 24, 2005 Share Posted February 24, 2005 Well the other contribution worked fine before installing sppc v4. So it goes both ways. I don't understand, these are both very popular contribs. (the other contribution is Product Attribute: Option Type Feature) <{POST_SNAPBACK}> Most likely, you are missing a curly bracket or have an extra one somewhere . Check to make sure you are not missing one. Remember that it could be caused by an extra curly bracket anywhere above the error in the file. The best bet is to start fresh and try to find the differences in the curly brackets before you make a change. Quote Link to comment Share on other sites More sharing options...
adam71o Posted February 24, 2005 Share Posted February 24, 2005 Another problem, I just made a totally fresh new installation of osc ms2.2, then installed SPPC v4, and it is not working. In the admin side, I have a user set to "wholesale" group, but he still views the retail price (when logged in). Quote Link to comment Share on other sites More sharing options...
adam71o Posted February 24, 2005 Share Posted February 24, 2005 (edited) .........so right now, in my store, the SPPC v4 contrib. is NOT working by itself. I used the easy install, as I had just installed osc ~ 40 seconds before. Overwrote stock osc files with the ones included in the contrib. Ran "sppc_v40_install.sql", and its just not working right. I am able to create customer groups, assign customers to groups, and assign customer group prices under product descriptions, but the normal retail prices is shown for logged in visitors of my "wholesale" group. Edited February 24, 2005 by adam71o Quote Link to comment Share on other sites More sharing options...
adam71o Posted February 24, 2005 Share Posted February 24, 2005 I totally removed that new osc installation, did it all over again, now its working. WSHEW. Now that its working, I can appreciate how great this contrib. is, great work! Quote Link to comment Share on other sites More sharing options...
Marvin Miller Posted February 24, 2005 Share Posted February 24, 2005 .........so right now, in my store, the SPPC v4 contrib. is NOT working by itself.<{POST_SNAPBACK}> That's odd. It's worked on my servers for more then a month now with all kinds of installs through the development process. It appears to be working for the other people that installed it. Curious.... Let's see, I have a clean Milestone 2 install here to test it on (again). I used the SQL un-install script to remove the db entries, uploaded all the files from the pre-packaged contrib, re-ran the install script, created a Wholesale group, defined a wholesale group price for a product, logged in as a member of the wholesale group and - voila - proper Separate Pricing. I can't see any way for it to NOT work on a clean install. Most likely you forgot to create a customer group or a special price OR you didn't log back off and back in. You have to logoff and then log back in before you will see any of the updated prices. I repeat, the contrib works fine on a clean install. The manual install docs were tested several times. It may not work with 3rd party contribs - because that's the nature of contribs. The person who wrote your 3rd party contribution did not write it with an eye towards collaborating with the new Separate Price release. They, like 99% of the contribs are written independantly of each other. This means that when you install contribs there is always the chance that they will not work perfectly with other contribs and then you have to find out why. Unfortunately this usually requires some knowledge of PHP and the ability to understand what a page is actually doing. I repeat, the contrib works fine on a clean install. Quote Best & Thanks;Marvin----------------------osCommerce 2.3.3.4 Link to comment Share on other sites More sharing options...
Marvin Miller Posted February 24, 2005 Share Posted February 24, 2005 I totally removed that new osc installation, did it all over again, now its working. WSHEW. Now that its working, I can appreciate how great this contrib. is, great work! <{POST_SNAPBACK}> It is pretty cool & I'm glad you got it working. If you do a manual install of the other contrib you had you'll probably find the same issue on the same page. As mentioned, it's likely caused by having an extra or a missing }. I bet the reason you weren't seeing the wholesale price is because you didn't log off and log back in after defining it. Glad you got it straightened out :D Quote Best & Thanks;Marvin----------------------osCommerce 2.3.3.4 Link to comment Share on other sites More sharing options...
adam71o Posted February 24, 2005 Share Posted February 24, 2005 (edited) Marvin you are right. The ONE conflict between these two contributions is in catalog/includes/classes/shopping_cart.php , there is a { somewhere where there shouldn't be, and its driving me MAD trying to find it! ======== Is there a tool of some sort that points out "{" and other tags that aren't opened or closed correctly? Edited February 24, 2005 by adam71o Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted February 24, 2005 Share Posted February 24, 2005 Is there a tool of some sort that points out "{" and other tags that aren't opened or closed correctly?If you install JEdit (www.jedit.org) and put your cursor next to a curly brace it will show you in the margin where the closing or opening brace is. I find it a great help in these difficult cases where you lose all the overview on where those start and end. It's open source and for multiple platforms. Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted February 24, 2005 Share Posted February 24, 2005 Dave, Wow! I don't have that mod installed. So I wonder what my problem was. Hmmm....In hindsight it might have been better to have the function tep_db_check_age_specials_retail_table do a "return true;" in all cases and change (around line 147 in index.php): // BOF Separate Pricing Per Customer if(!tep_session_is_registered('sppc_customer_group_id')) { $customer_group_id = '0'; } else { $customer_group_id = $sppc_customer_group_id; } // 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(); } to: // BOF Separate Pricing Per Customer if(!tep_session_is_registered('sppc_customer_group_id')) { $customer_group_id = '0'; } else { $customer_group_id = $sppc_customer_group_id; } // 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') { $check_specials_table = tep_db_check_age_specials_retail_table(); } What might have happened is that the code execution wasn't waiting for tep_db_check_age_specials_retail_table to finish and went ahead, only to find the table was still being built. In the testing we did, the specials table might not have been large enough to trigger what you experienced? Quote Link to comment Share on other sites More sharing options...
adam71o Posted February 24, 2005 Share Posted February 24, 2005 (edited) If you install JEdit (www.jedit.org) and put your cursor next to a curly brace it will show you in the margin where the closing or opening brace is. I find it a great help in these difficult cases where you lose all the overview on where those start and end. It's open source and for multiple platforms. This IS a pretty cool tool, although I'm not sure how to use it to my advantage. The problem with this file is that I have an extra } . It has no partner {. Hmmm Edited February 24, 2005 by adam71o Quote Link to comment Share on other sites More sharing options...
adam71o Posted February 24, 2005 Share Posted February 24, 2005 (edited) Is there any way I can paypal somebody $5 to fix this one file? The error returned from the browser is: Parse error: parse error, unexpected '}' in /home/petinst/public_html/store/includes/classes/shopping_cart.php on line 405 It shouldn't take long for someone with some skill. I don't know, I'm just ready to give up on the combination of these 2 contributions, that my company really does need on this site. GAAAAAAAAH ============================= If anyone is interested or has any recommendations, you can hit me up on aim, via my profile. Edited February 24, 2005 by adam71o Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted February 24, 2005 Share Posted February 24, 2005 (edited) Parse error: parse error, unexpected '}' in /home/petinst/public_html/store/includes/classes/shopping_cart.php on line 405If I paste your code in my includes/classes/shopping_cart.php the starting } of the function doesn't end at the last line of the function but somewhere in the middle.If you paste the complete function (from the line function get_products() { ) we could get the complete picture. That would give us a chance to spot the error. Actually, if you comment out that particular '}' the opening } ends at the correct place. Might be the only thing needed... // EOF Separate Pricing Per Customer ? ? ? ? //?} ? ? ? ? ?//clr 030714 update $products_array to include attribute value_text. This is needed for text attributes. Edited February 24, 2005 by JanZ Quote Link to comment Share on other sites More sharing options...
adam71o Posted February 24, 2005 Share Posted February 24, 2005 (edited) ? ?function get_products() { ? ? ?global $languages_id; ? // BOF Separate Pricing Per Customer // global variable (session) $sppc_customer_group_id -> class variable cg_id ?global $sppc_customer_group_id; ?if(!tep_session_is_registered('sppc_customer_group_id')) { ?$this->cg_id = '0'; ?} else { ? $this->cg_id = $sppc_customer_group_id; ?} // EOF Separate Pricing Per Customer ? ? ?if (!is_array($this->contents)) return false; ? ? ?$products_array = array(); ? ? ?reset($this->contents); ? ? ?while (list($products_id, ) = each($this->contents)) { ? ? ? ?$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); ? ? ? ?if ($products = tep_db_fetch_array($products_query)) { ? ? ? ? ?$prid = $products['products_id']; ? ? ? ? ?$products_price = $products['products_price']; ? ? ? ? ?// BOF Separate Pricing Per Customer /* ? ? ? ? ?$specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'"); ? ? ? ? ? ? ? ? ?if (tep_db_num_rows($specials_query)) { ? ? ? ? ? ?$specials = tep_db_fetch_array($specials_query); ? ? ? ? ? ?$products_price = $specials['specials_new_products_price']; ? ? ? ? ?} */ ? $specials_price = tep_get_products_special_price($prid); ?if (tep_not_null($specials_price)) { ?$products_price = $specials_price; ? ? ?} elseif ($this->cg_id != 0){ ? ? ? ?$customer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$prid . "' and customers_group_id = ?'" . $this->cg_id . "'"); ? ? ? ?if ($customer_group_price = tep_db_fetch_array($customer_group_price_query)) { ? ? ? ?$products_price = $customer_group_price['customers_group_price']; ? ? ? ?} ?} // EOF Separate Pricing Per Customer ? ? ? ? ?} ? ? ? ? ?//clr 030714 update $products_array to include attribute value_text. This is needed for text attributes. ? ? ? ? ?$products_array[] = array('id' => $products_id, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'name' => $products['products_name'], ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'model' => $products['products_model'], ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'image' => $products['products_image'], ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'price' => $products_price, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'quantity' => $this->contents[$products_id]['qty'], ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'weight' => $products['products_weight'], ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'final_price' => ($products_price + $this->attributes_price($products_id)), ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'tax_class_id' => $products['products_tax_class_id'], ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'attributes' => (isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : ''), ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'attributes_values' => (isset($this->contents[$products_id]['attributes_values']) ? $this->contents[$products_id]['attributes_values'] : '')); ? ? ? ?} ? ? ?} ? ? ?return $products_array; ? ?} ? ?function show_total() { ? ? ?$this->calculate(); ? ? ?return $this->total; ? ?} ? ?function show_weight() { ? ? ?$this->calculate(); ? ? ?return $this->weight; ? ?} ? ?function generate_cart_id($length = 5) { ? ? ?return tep_create_random_value($length, 'digits'); ? ?} ? ?function get_content_type() { ? ? ?$this->content_type = false; ? ? ?if ( (DOWNLOAD_ENABLED == 'true') && ($this->count_contents() > 0) ) { ? ? ? ?reset($this->contents); ? ? ? ?while (list($products_id, ) = each($this->contents)) { ? ? ? ? ?if (isset($this->contents[$products_id]['attributes'])) { ? ? ? ? ? ?reset($this->contents[$products_id]['attributes']); ? ? ? ? ? ?while (list(, $value) = each($this->contents[$products_id]['attributes'])) { ? ? ? ? ? ? ?$virtual_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad where pa.products_id = '" . (int)$products_id . "' and pa.options_values_id = '" . (int)$value . "' and pa.products_attributes_id = pad.products_attributes_id"); ? ? ? ? ? ? ?$virtual_check = tep_db_fetch_array($virtual_check_query); ? ? ? ? ? ? ?if ($virtual_check['total'] > 0) { ? ? ? ? ? ? ? ?switch ($this->content_type) { ? ? ? ? ? ? ? ? ?case 'physical': ? ? ? ? ? ? ? ? ? ?$this->content_type = 'mixed'; ? ? ? ? ? ? ? ? ? ?return $this->content_type; ? ? ? ? ? ? ? ? ? ?break; ? ? ? ? ? ? ? ? ?default: ? ? ? ? ? ? ? ? ? ?$this->content_type = 'virtual'; ? ? ? ? ? ? ? ? ? ?break; ? ? ? ? ? ? ? ?} ? ? ? ? ? ? ?} else { ? ? ? ? ? ? ? ?switch ($this->content_type) { ? ? ? ? ? ? ? ? ?case 'virtual': ? ? ? ? ? ? ? ? ? ?$this->content_type = 'mixed'; ? ? ? ? ? ? ? ? ? ?return $this->content_type; ? ? ? ? ? ? ? ? ? ?break; ? ? ? ? ? ? ? ? ?default: ? ? ? ? ? ? ? ? ? ?$this->content_type = 'physical'; ? ? ? ? ? ? ? ? ? ?break; ? ? ? ? ? ? ? ?} ? ? ? ? ? ? ?} ? ? ? ? ? ?} ? ? ? ? ?} else { ? ? ? ? ? ?switch ($this->content_type) { ? ? ? ? ? ? ?case 'virtual': ? ? ? ? ? ? ? ?$this->content_type = 'mixed'; ? ? ? ? ? ? ? ?return $this->content_type; ? ? ? ? ? ? ? ?break; ? ? ? ? ? ? ?default: ? ? ? ? ? ? ? ?$this->content_type = 'physical'; ? ? ? ? ? ? ? ?break; ? ? ? ? ? ?} ? ? ? ? ?} ? ? ? ?} ? ? ?} else { ? ? ? ?$this->content_type = 'physical'; ? ? ?} ? ? ?return $this->content_type; ? ?} ? ?function unserialize($broken) { ? ? ?for(reset($broken);$kv=each($broken);) { ? ? ? ?$key=$kv['key']; ? ? ? ?if (gettype($this->$key)!="user function") ? ? ? ?$this->$key=$kv['value']; ? ? ?} ? ?} ?} ?> "//clr" marks the "Product Attributes - Option type feature" contrib. code Edited February 24, 2005 by adam71o Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted February 24, 2005 Share Posted February 24, 2005 IMO the '}' I showed in post 412 is one too many. If I comment it out in your complete function, it tells me that everything should work fine. Quote Link to comment Share on other sites More sharing options...
adam71o Posted February 24, 2005 Share Posted February 24, 2005 (edited) After that change: Parse error: parse error, unexpected '}' in /home/petinst/public_html/store/includes/classes/shopping_cart.php on line 487 ... which is at the very end. If I remove that one, I get: Fatal error: Cannot redeclare unserialize() in /home/petinst/public_html/store/includes/classes/shopping_cart.php on line 479 Edited February 24, 2005 by adam71o Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted February 24, 2005 Share Posted February 24, 2005 After that change:This one? // EOF Separate Pricing Per Customer ? ? ? ? //?} ? ? ? ? ?//clr 030714 update $products_array to include attribute value_text. This is needed for text attributes. IMO that is the one that should be commented out and gives the error. Just checking if we are talking about the same } ... Quote Link to comment Share on other sites More sharing options...
adam71o Posted February 24, 2005 Share Posted February 24, 2005 (edited) Sorry for the confusion.......... After commenting out the "}" in... // EOF Separate Pricing Per Customer ? ? ? ?// } ? ? ? ? //clr 030714 update $products_array to include attribute value_text. This is needed for text attributes. I get this error: Parse error: parse error, unexpected '}' in /home/petinst/public_html/store/includes/classes/shopping_cart.php on line 487 .......and 487 is at the end of the file: 487 } 488 ?> Edited February 24, 2005 by adam71o Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted February 24, 2005 Share Posted February 24, 2005 I would look at the function above it: function attributes_price($products_id) It could well be that that function is missing the "}". The get_products() is fine IMO. Quote Link to comment Share on other sites More sharing options...
adam71o Posted February 24, 2005 Share Posted February 24, 2005 (edited) Heres function attributes_price($products_id) { function attributes_price($products_id) { $attributes_price = 0; if (isset($this->contents[$products_id]['attributes'])) { reset($this->contents[$products_id]['attributes']); while (list($option, $value) = each($this->contents[$products_id]['attributes'])) { $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'"); $attribute_price = tep_db_fetch_array($attribute_price_query); if ($attribute_price['price_prefix'] == '+') { $attributes_price += $attribute_price['options_values_price']; } else { $attributes_price -= $attribute_price['options_values_price']; } } } return $attributes_price; } function get_products() { ... Edited February 24, 2005 by adam71o Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted February 24, 2005 Share Posted February 24, 2005 Heres function attributes_price($products_id) {Exactly the same as mine, can't be it. I can tell you that I put your code (with that particular } commented out) into my catalog/includes/classes/shopping_cart.php and there is no parse error :huh: Perhaps you commented out a "}" or a "{" and forgot to reverse that change? I don't know what to say.... Quote Link to comment Share on other sites More sharing options...
adam71o Posted February 24, 2005 Share Posted February 24, 2005 Well I believe you, I'm checking out my file. Quote Link to comment Share on other sites More sharing options...
adam71o Posted February 25, 2005 Share Posted February 25, 2005 (edited) I just totally re-appended the file from the stock. And am getting the same error. This makes no sense, why would it work fine for you, but not for me? The problem is DEFINATELY IN this file (catalog/includes/classes/shopping_cart.php), right? Well, I guess so since the error specifies "/home/petinst/public_html/store/includes/classes/shopping_cart.php" ========= btw, to avoid any confusion, my store is in /store, instead of /catalog Edited February 25, 2005 by adam71o Quote Link to comment Share on other sites More sharing options...
dblake Posted February 25, 2005 Share Posted February 25, 2005 Repaste your function get_products() Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted February 25, 2005 Share Posted February 25, 2005 I just totally re-appended the file from the stock. And am getting the same error. This makes no sense, why would it work fine for you, but not for me? The problem is DEFINATELY IN this file (catalog/includes/classes/shopping_cart.php), right?Absolutely. The only thing I can suggest is take the includes/classes/shopping_cart.php from the SPPC 4 zip and append the changes for the other mod to that file. This is the code I took from you, pasted in and gave no parse error: function get_products() { ? ? ?global $languages_id; ? // BOF Separate Pricing Per Customer // global variable (session) $sppc_customer_group_id -> class variable cg_id ?global $sppc_customer_group_id; ?if(!tep_session_is_registered('sppc_customer_group_id')) { ?$this->cg_id = '0'; ?} else { ? $this->cg_id = $sppc_customer_group_id; ?} // EOF Separate Pricing Per Customer ? ? ?if (!is_array($this->contents)) return false; ? ? ?$products_array = array(); ? ? ?reset($this->contents); ? ? ?while (list($products_id, ) = each($this->contents)) { ? ? ? ?$products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); ? ? ? ?if ($products = tep_db_fetch_array($products_query)) { ? ? ? ? ?$prid = $products['products_id']; ? ? ? ? ?$products_price = $products['products_price']; ? ? ? ? ?// BOF Separate Pricing Per Customer line 362 /* ? ? ? ? ?$specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'"); ? ? ? ? ? ? ? ? ?if (tep_db_num_rows($specials_query)) { ? ? ? ? ? ?$specials = tep_db_fetch_array($specials_query); ? ? ? ? ? ?$products_price = $specials['specials_new_products_price']; ? ? ? ? ?} */ ? $specials_price = tep_get_products_special_price($prid); ?if (tep_not_null($specials_price)) { ?$products_price = $specials_price; ? ? ?} elseif ($this->cg_id != 0){ ? ? ? ?$customer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$prid . "' and customers_group_id = ?'" . $this->cg_id . "'"); ? ? ? ?if ($customer_group_price = tep_db_fetch_array($customer_group_price_query)) { ? ? ? ?$products_price = $customer_group_price['customers_group_price']; ? ? ? ?} ?} // EOF Separate Pricing Per Customer ? ? ? ? //?} ? ? ? ? ?//clr 030714 update $products_array to include attribute value_text. This is needed for text attributes. ? ? ? ? ?$products_array[] = array('id' => $products_id, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'name' => $products['products_name'], ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'model' => $products['products_model'], ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'image' => $products['products_image'], ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'price' => $products_price, ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'quantity' => $this->contents[$products_id]['qty'], ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'weight' => $products['products_weight'], ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'final_price' => ($products_price + $this->attributes_price($products_id)), ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'tax_class_id' => $products['products_tax_class_id'], ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'attributes' => (isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : ''), ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'attributes_values' => (isset($this->contents[$products_id]['attributes_values']) ? $this->contents[$products_id]['attributes_values'] : '')); ? ? ? ?} ? ? ?} ? ? ?return $products_array; ? ?} Quote Link to comment Share on other sites More sharing options...
adam71o Posted February 25, 2005 Share Posted February 25, 2005 I'm not sure where that function ends, so here's that function to the end of the file: function get_products() { global $languages_id; // BOF Separate Pricing Per Customer // global variable (session) $sppc_customer_group_id -> class variable cg_id global $sppc_customer_group_id; if(!tep_session_is_registered('sppc_customer_group_id')) { $this->cg_id = '0'; } else { $this->cg_id = $sppc_customer_group_id; } // EOF Separate Pricing Per Customer if (!is_array($this->contents)) return false; $products_array = array(); reset($this->contents); while (list($products_id, ) = each($this->contents)) { $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); if ($products = tep_db_fetch_array($products_query)) { $prid = $products['products_id']; $products_price = $products['products_price']; // BOF Separate Pricing Per Customer /* $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'"); if (tep_db_num_rows($specials_query)) { $specials = tep_db_fetch_array($specials_query); $products_price = $specials['specials_new_products_price']; } */ $specials_price = tep_get_products_special_price($prid); if (tep_not_null($specials_price)) { $products_price = $specials_price; } elseif ($this->cg_id != 0){ $customer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$prid . "' and customers_group_id = '" . $this->cg_id . "'"); if ($customer_group_price = tep_db_fetch_array($customer_group_price_query)) { $products_price = $customer_group_price['customers_group_price']; } } // EOF Separate Pricing Per Customer // } //clr 030714 update $products_array to include attribute value_text. This is needed for text attributes. $products_array[] = array('id' => $products_id, 'name' => $products['products_name'], 'model' => $products['products_model'], 'image' => $products['products_image'], 'price' => $products_price, 'quantity' => $this->contents[$products_id]['qty'], 'weight' => $products['products_weight'], 'final_price' => ($products_price + $this->attributes_price($products_id)), 'tax_class_id' => $products['products_tax_class_id'], 'attributes' => (isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : ''), 'attributes_values' => (isset($this->contents[$products_id]['attributes_values']) ? $this->contents[$products_id]['attributes_values'] : '')); } } return $products_array; } function show_total() { $this->calculate(); return $this->total; } function show_weight() { $this->calculate(); return $this->weight; } function generate_cart_id($length = 5) { return tep_create_random_value($length, 'digits'); } function get_content_type() { $this->content_type = false; if ( (DOWNLOAD_ENABLED == 'true') && ($this->count_contents() > 0) ) { reset($this->contents); while (list($products_id, ) = each($this->contents)) { if (isset($this->contents[$products_id]['attributes'])) { reset($this->contents[$products_id]['attributes']); while (list(, $value) = each($this->contents[$products_id]['attributes'])) { $virtual_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad where pa.products_id = '" . (int)$products_id . "' and pa.options_values_id = '" . (int)$value . "' and pa.products_attributes_id = pad.products_attributes_id"); $virtual_check = tep_db_fetch_array($virtual_check_query); if ($virtual_check['total'] > 0) { switch ($this->content_type) { case 'physical': $this->content_type = 'mixed'; return $this->content_type; break; default: $this->content_type = 'virtual'; break; } } else { switch ($this->content_type) { case 'virtual': $this->content_type = 'mixed'; return $this->content_type; break; default: $this->content_type = 'physical'; break; } } } } else { switch ($this->content_type) { case 'virtual': $this->content_type = 'mixed'; return $this->content_type; break; default: $this->content_type = 'physical'; break; } } } } else { $this->content_type = 'physical'; } return $this->content_type; } function unserialize($broken) { for(reset($broken);$kv=each($broken);) { $key=$kv['key']; if (gettype($this->$key)!="user function") $this->$key=$kv['value']; } } } ?> 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.