Jan Zonjee Posted February 27, 2007 Share Posted February 27, 2007 Yes - the checkboxes are there and I can check them - it just doesn't post that it's been checked to the database :huh: I sort of understand what you want me to print - but I'm not sure how to do it. Could you show me an example of what would go in print_r($*this spot) to print the HTTP_POST_VARS ? For example: //Master Products case 'insert_master': case 'update_master': echo '<pre>'; print_r($HTTP_POST_VARS); exit(); Quote Link to comment Share on other sites More sharing options...
TracyS Posted February 27, 2007 Share Posted February 27, 2007 For example: //Master Products case 'insert_master': case 'update_master': echo '<pre>'; print_r($HTTP_POST_VARS); exit(); Thank you - looks a whole lot easier than my brain thought it was - :blush: Here is what I get: Array ( [osCAdminID] => 9323cad96c27c6938364e286fc94bf75 [products_status] => 1 [products_date_available] => [manufacturers_id] => [products_tax_class_id] => 0 [products_price] => 0.0000 [products_price_gross] => 0 [products_quantity] => 0 [products_model] => [products_previous_image] => morningsicknessbalm.jpg [products_sort_order] => 1 [products_master_status] => 1 [products_date_added] => 2006-10-12 12:31:12 [x] => 19 [y] => 3 [products_name] => Array ( [1] => Morning Sickness Balm [2] => Morning Sickness Balm [3] => Morning Sickness Balm ) Shouldn't I have a [products_hide_from_groups] in there? I did check a box to try to hide it before getting the above array :huh: Quote ~Tracy Link to comment Share on other sites More sharing options...
Guest Posted February 28, 2007 Share Posted February 28, 2007 I don't see (code wise) how this could happen unless you are missing all the special prices and group prices for your customers group 3. In that case the missing global $sppc_customer_group_id might be the culprit. Try changing the: if(!tep_session_is_registered('sppc_customer_group_id')) { $customer_group_id = '0'; } else { $customer_group_id = $sppc_customer_group_id; } to the more reliable: 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'; } Dear JanZ Thanks for your reply. I tried that but the listing is the same. I tested out to display different products and found that ONLY products that belong to more than one category if displayed on any page, the listing creates such problems, i.e. part of which and usually the top (nearly) half page of the list is okay but the bottom (nearly) half page of products display the original, non-discounted prices, without displaying the new discounted prices in RED colors on the left hand side of the original non-discounted prices. However, as I described the problem in my previous mail, if we click the "Buy Now" button, the shopping cart would still count the "Discount prices". On the other hand, if the page contains products that belong to ONLY one category, the listing is normal. Do you remember last time you helped fix the problem to avoid displaying duplicated products in the list. Your new codes could successfully display products (which belong to more than one category) without duplications. I am not sure if the above information would be helpful. Thanks again for your help. Looking forward to your further instructions. Cheers James Quote Link to comment Share on other sites More sharing options...
freakystreak Posted February 28, 2007 Share Posted February 28, 2007 Is it possible to have a seperate index page for each customer group? E.g. Schools group would have 'Welcome to ......Schools page'. Basically an index page customed to that customer group. Quote Ah, the world wide web. What a wonderful place. Link to comment Share on other sites More sharing options...
hllbll Posted February 28, 2007 Share Posted February 28, 2007 Hi, I have just started to configure our webshop, and I installed this SPPC contribution. I'm quite sure I did everything correctly, but when I try accessing the shop, it gives me an error: Parse error: parse error, unexpected '*' in /home/wiequ/wiequ-www/catalog/includes/classes/shopping_cart.php on line 249 I tried to reconfigure that shopping_cart.php file from my backup, but no change. Here's how it looks like around line 249 specials_price = tep_get_products_special_price((int)$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 $this->total += tep_add_tax($products_price, $products_tax) * $qty; $this->weight += ($qty * $products_weight); <------------ This is the exact line 249! } // attributes price if (isset($this->contents[$products_id]['attributes'])) { reset($this->contents[$products_id]['attributes']); The Admin section seems to work fine though. Just can't test it very much, because I can't create test accounts or anything yet. Thanks in advance! - Marko - Quote Link to comment Share on other sites More sharing options...
Guest Posted February 28, 2007 Share Posted February 28, 2007 No, I checked the SPPC415 version of advanced_search_results.php now and that is causing the problem. Better use the 4.11 version of that page and add the MySQL5 fixes mentioned in this post on page 122. Fixed perfectly, thank you JanZ. I've commented out all manufacturers input fields as that is not required, so the similar issue there is not relevant. One quick thing you might be able to help with. I need the option to have a fixed text line on the product description and then the same again with a check box on payment_shipping or payment_checkout for the wholesale customer group but not visible to the default group. A bit like the function tep_customer_greeting() { if logged in says one thing else says the other. Is there a SPPC function that does something like this I can duplicate and then change the copy to call the correct text line? Again many thanks for all your help, do you have a PayPal account if you PM me details I will happily send you a thank you for your efforts. Many thanks Katie. Quote Link to comment Share on other sites More sharing options...
Jimster Posted February 28, 2007 Share Posted February 28, 2007 Has anyone used Securetrading as a gateway and This modification? I am having a nightmare trying to get my shop working. What happens is Customer pays on the ST site, the callback sends them back to my site. However once returning to my site, they are resented with a login page The login page is shown due to this part in the checkout_process.php // if the customer is not logged on, redirect them to the login page if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_PAYMENT)); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } if (!tep_session_is_registered('sendto')) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); } if ( (tep_not_null(MODULE_PAYMENT_INSTALLED)) && (!tep_session_is_registered('payment')) ) { tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')); } So i took that out after sending the customer_id thorugh ST with the same thing still happening. Once this was out i got to the sucess page, but the order is still in the basket, there is no order in the admin CP and there is no products showing where it says something about notifications etc. HOWEVER, with a fresh install of OSC without the SPPC mod it works If you require any further info please do not hesitate to ask for it, I realy realy want to get this sorted! Many Thanks, Chris Quote Link to comment Share on other sites More sharing options...
TracyS Posted February 28, 2007 Share Posted February 28, 2007 Hi Jan, I am so far beyond stuck it's pitiful :blush: I am trying to figure out how to see the contents of the cart so I can check a couple of things against it, and for the life of me I cannot get the contents :huh: Here is my latest attempt: function packet_coupon() { global $cart; if( strtolower( $this->coupon['coupons_id'] ) == strtolower( 'PACKET' ) ) { //strtolower() to avoid case issues $packet_array = array( 158, 159, 150, 151, 156, 157, 172, 173, 174, 208, 164, 165, 213, 202 ); //array of valid ids to use with this coupon $prod_ids = $cart->get_product_id_list(); //we need to get an array of the products ids in the cart $prod_ids_array = array(); $prod_ids_temp_array = explode(", ", $prod_ids ); if( !in_array( 206, $prod_ids_temp_array ) { //if 206 is not of our items $this->message( ENTRY_DISCOUNT_COUPON_PACKET_ERROR ); //replace with packet error } } } That one keeps giving me an error that the '{' in the last if statement is unexpected - which really throws me for a loop. I was told to try something like this: //this function is for tracking the product totals and count so that we can correctly calculate the discount function total_valid_products( $products = array() ) { global $cart; if( strtolower( $this->coupon['coupons_id'] ) == strtolower( 'PACKET' ) ) { //strtolower() to avoid case issues $packet_array = array( 158, 159, 150, 151, 156, 157, 172, 173, 174, 208, 164, 165, 213, 202 ); //array of valid ids to use with this coupon $product_ids = array(); //we need to get an array of the products ids in the cart for( $i = 0; $i < count( $products ); $i++ ) { if( in_array( $products[$i]['id'], $packet_array ) ) $product_ids[] = $products[$i]['id']; //add to our array of product ids if it is one of the packet items $price = ( $this->apply_tax( $products[$i]['price'] + $cart->attributes_price( $products[$i]['id'] ), $products[$i]['tax'] ) * $products[$i]['quantity'] ); $this->cart_info['total_products']['total'] += $price; $this->cart_info['total_products']['count'] += $products[$i]['quantity']; $this->cart_info['total_products']['line_items']++; if( $this->is_allowed_product( tep_get_prid( $products[$i]['id'] ) ) ) { //not an excluded product $this->cart_info['valid_products']['count'] += $products[$i]['quantity']; $this->cart_info['valid_products']['total'] += $price; $this->cart_info['valid_products']['line_items']++; } } //now that we have a complete array of product ids, make sure our required products are in it if( !in_array( 206, $product_ids ) || count( $product_ids ) < 1 ) { //if 206 is not of our items, or there are no acceptable products in the cart, then we can't allow the coupon $this->message( ENTRY_DISCOUNT_COUPON_ERROR ); //replace with packet error } } which didn't return the results I needed - even when I renamed it to it's own function so it wouldn't interfere with the total_valid_products function. The product ids in the cart are referenced (I believe) in other spots on the same page of scripting like this $product_id: //product exclusion if( !is_array( $this->cart_info['exclusions']['products'] ) ) { //only create the array when we need to and only once //check to see if the product is in one of the limited categories $check_product_query = tep_db_query( $sql = 'SELECT products_id FROM '.TABLE_DISCOUNT_COUPONS_TO_PRODUCTS.' WHERE coupons_id="'.tep_db_input( $this->coupon['coupons_id'] ).'"' ); $this->cart_info['exclusions']['products'] = array(); if( tep_db_num_rows( $check_product_query ) > 0 ) { while( $products = tep_db_fetch_array( $check_product_query ) ) { $this->cart_info['exclusions']['products'][] = $products['products_id']; } } } if( count( $this->cart_info['exclusions']['products'] ) > 0 ) { if( in_array( $product_id, $this->cart_info['exclusions']['products'] ) ) { //use this to debug exclusions: if( MODULE_ORDER_TOTAL_DISCOUNT_COUPON_DEBUG == 'true' ) $this->message( 'INFO: Product '.$product_id.' failed product exclusion check', 'debug' ); return false; } } //end product exclusion The final if statement I believe is saying that if a product_id in the cart ($product_id) is in the array of excluded products (['exclusions']['products']) then it will generate an error. For some reason though - I can't seem to figure out for the life of me how to reference that $product_id array from the cart to see if, for example, 206 is in it. Logically it seems like this should be a fairly straight-forward thing to do - but I just can't seem to find the right bit of code to get that blasted array. Would you be able to shed any light on this for me at all? I've spent several days on this now, and gone through my new books, and I'm totally lost as to why I can't seem to utilize or get or even find the product_id 's in the cart :blush: Quote ~Tracy Link to comment Share on other sites More sharing options...
Jan Zonjee Posted February 28, 2007 Share Posted February 28, 2007 Shouldn't I have a [products_hide_from_groups] in there? I did check a box to try to hide it before getting the above array Yes, you should. Did you in the section: //Master Products } elseif ($action == 'new_master_preview') { if (tep_not_null($HTTP_POST_VARS)) { Also make the change for the hide post variables (which are an array...): /* Re-Post all POST'ed variables */ reset($HTTP_POST_VARS); while (list($key, $value) = each($HTTP_POST_VARS)) { // if (!is_array($HTTP_POST_VARS[$key])) { // BOF Separate Pricing per Customer if (is_array($value)) { while (list($k, $v) = each($value)) { echo tep_draw_hidden_field($key . '[' . $k . ']', htmlspecialchars(stripslashes($v))); } } else { // EOF Separate Pricing per Customer Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted February 28, 2007 Share Posted February 28, 2007 I tested out to display different products and found that ONLY products that belong to more than one category if displayed on any page, the listing creates such problems, i.e. part of which and usually the top (nearly) half page of the list is okay but the bottom (nearly) half page of products display the original, non-discounted prices, without displaying the new discounted prices in RED colors on the left hand side of the original non-discounted prices. However, as I described the problem in my previous mail, if we click the "Buy Now" button, the shopping cart would still count the "Discount prices". On the other hand, if the page contains products that belong to ONLY one category, the listing is normal. Do you remember last time you helped fix the problem to avoid displaying duplicated products in the list. Your new codes could successfully display products (which belong to more than one category) without duplications. I am not sure if the above information would be helpful. I don't understand why that is happening, since modules/product_listing.php does not depend on prices that came with the results of the original query but looks up the special prices and customer group prices. You did change the variable $no_of_listings as I suggested (should be the size of the array $listing after pruning the duplicates, not the number of rows from the original query, although I cannot fathom why that should cause such an error if you didn't). Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted February 28, 2007 Share Posted February 28, 2007 I have just started to configure our webshop, and I installed this SPPC contribution. I'm quite sure I did everything correctly, but when I try accessing the shop, it gives me an error:I tried to reconfigure that shopping_cart.php file from my backup, but no change. Here's how it looks like around line 249 The Admin section seems to work fine though. Just can't test it very much, because I can't create test accounts or anything yet. What a bizar error. Are you 100% sure it is that line? Can't it be a comment /* */ went wrong somewhere? Never seen this one before. Tried removing the spaces around the "*"? Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted February 28, 2007 Share Posted February 28, 2007 One quick thing you might be able to help with. I need the option to have a fixed text line on the product description and then the same again with a check box on payment_shipping or payment_checkout for the wholesale customer group but not visible to the default group. A bit like the function tep_customer_greeting() { if logged in says one thing else says the other. Is there a SPPC function that does something like this I can duplicate and then change the copy to call the correct text line? Not a function but a little if/else goes a long way.do you have a PayPal account No, I don't :) Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted February 28, 2007 Share Posted February 28, 2007 I am trying to figure out how to see the contents of the cart so I can check a couple of things against it, and for the life of me I cannot get the contents I think it is rather diffferent on checkout_confirmation.php then on other pages. This is the printing of the object cart on that page for two items (with products_id 5 and 6 respectively): Cart: shoppingcart Object ( [contents] => Array ( [5] => Array ( [qty] => 1 ) [6] => Array ( [qty] => 1 ) ) [total] => 75.98 [weight] => 14 [cartID] => 18858 [content_type] => physical [cg_id] => 1 ) So I guess you would have to iterate through the array $cart['contents'] where $key would be the products_id. Alternatively, you could use the object $order. This is the relevant part that contains the products above: [products] => Array ( [0] => Array ( [qty] => 1 [name] => Blade Runner - Director's Cut [model] => DVD-BLDRNDC [tax] => 0 [tax_description] => Unknown tax rate [price] => 35.9900 [final_price] => 35.99 [weight] => 7.00 [id] => 5 ) [1] => Array ( [qty] => 1 [name] => The Matrix [model] => DVD-MATR [tax] => 0 [tax_description] => Unknown tax rate [price] => 39.9900 [final_price] => 39.99 [weight] => 7.00 [id] => 6 ) ) Here is my latest attempt: if( !in_array( 206, $prod_ids_temp_array ) { //if 206 is not of our items That one keeps giving me an error that the '{' in the last if statement is unexpected - which really throws me for a loop. You are missing a ) on that line. I was told to try something like this: $this->cart_info['total_products']['total'] += $price; I couldn't find a single reference to cart_info in one of the SPPC test shops.... Quote Link to comment Share on other sites More sharing options...
Guest Posted March 1, 2007 Share Posted March 1, 2007 (edited) Edited March 1, 2007 by booksfarm Quote Link to comment Share on other sites More sharing options...
Guest Posted March 1, 2007 Share Posted March 1, 2007 Quote Link to comment Share on other sites More sharing options...
Guest Posted March 1, 2007 Share Posted March 1, 2007 Dear JanZ Sorry for the two previous posts. Try to redo it again hereunder: productlisting.php Thanks Quote Link to comment Share on other sites More sharing options...
hllbll Posted March 1, 2007 Share Posted March 1, 2007 Hi, I have just started to configure our webshop, and I installed this SPPC contribution. I'm quite sure I did everything correctly, but when I try accessing the shop, it gives me an error: I tried to reconfigure that shopping_cart.php file from my backup, but no change. Here's how it looks like around line 249 The Admin section seems to work fine though. Just can't test it very much, because I can't create test accounts or anything yet. Thanks in advance! - Marko - I managed to fix that problem last evening somehow (don't ask me how, not a clue, it was too late for that). Anyway, now shop seems to work fine, BUT: "quick search" and "advanced search" doesn't work anymore. You can access the advanced searc page, but after search, the search result page gives you error like this: Products meeting the search criteria 1066 - Not unique table/alias: 'pd' select count(distinct p.products_id) as total from products p left join manufacturers m using(manufacturers_id), products_description pd left join specials s on p.products_id = s.products_id, categories c, products_to_categories p2c, products_description pd, categories c, products_to_categories p2c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and ((pd.products_name like '%sma%' or p.products_model like '%sma%' or m.manufacturers_name like '%sma%') ) [TEP STOP] I did compare the edited files and original files with "Compare & Merge", and I found few lines, which had something like "product_id_string", when the original backup file was "product_id". Those lines weren't in this contribution, but when I installed this contribution, I did fix that original file to use that _string "extension", because I thought it was necessary. Now I have changed those lines back to that what they were, but it didn't get me anywhere. Same error, different day :) All the products are there, that's not the problem. Or I can just remove that "search-box" from there, that would of course be the easiest way to fix this problem, but I think that is not the best solution, though. Thanks again in advance, hope someone figures something I could try. I have time to test everything. And I even get payed for that :) -Marko- Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted March 1, 2007 Share Posted March 1, 2007 Anyway, now shop seems to work fine, BUT: "quick search" and "advanced search" doesn't work anymore. See this post for fixes. Quote Link to comment Share on other sites More sharing options...
Guest Posted March 1, 2007 Share Posted March 1, 2007 Not a function but a little if/else goes a long way. No, I don't :) Thank you again for your help. Katie Quote Link to comment Share on other sites More sharing options...
Guest Posted March 1, 2007 Share Posted March 1, 2007 Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted March 1, 2007 Share Posted March 1, 2007 James, I'm sorry I forgot to tell you that the problem only occurs when I log in as group members other than Group 0. If I log in as Group 0 --- the normal clients, the displays are normal without any problem. But whenever I log in as other groups, the product_listing page will 1. ONLY display normal prices for half the products that belong to more categories without displaying the special price next to the original prices. 2. display the top part correctly, usually around half the list on that page, but not necessarily "half" 3. display the bottom part (as described in #1 above) incorrectly, nearly half the list on that page. FYI, here belows are the amended codes of my product_listing.php file. With your productlisting.txt I could re-create that error. I don't really understand why it happened but there was a products_id = '' in the $select_list_of_prdct_ids that probably caused this to happen. I also saw that indeed it is a standard osC "feature" that if a product is in more than one category a search for a manufacturer will show up the product multiple times. I don't know if someone has come up with a better solution than the hack we are doing now, I would think so... Anyhow, this is what fixed it for me. Find around line 137 this piece of code and change it to this: while ($_listing = tep_db_fetch_array($listing_query)) { $_new_listing = array_merge($_listing , $default_settings); // in first iteration $_list_of_prdct_ids is not an array yet if (isset($_list_of_prdct_ids) && (!in_array($_new_listing['products_id'], $_list_of_prdct_ids))) { $listing[] = $_new_listing; $_list_of_prdct_ids[] = $_new_listing['products_id']; // if $_list_of_prdct_ids is not an array yet, the first item should be added } elseif (!isset($_list_of_prdct_ids)) { $listing[] = $_new_listing; $_list_of_prdct_ids[] = $_new_listing['products_id']; } } // end while ($_listing = tep_db_fetch_array($listing_query)) // no duplicate product_id's: $list_of_prdct_ids = array_unique($_list_of_prdct_ids); $no_of_listings = count($list_of_prdct_ids); // next part is a debug feature, when uncommented it will print the info that this module receives Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted March 1, 2007 Share Posted March 1, 2007 I now have an error on the product_info.php pageFatal error: Call to undefined function: tep_get_tax_rate() in /home/infinity/public_html/catalog/product_info.php on line 122 I'm confused :( Nothing changed on this line (it's bolded). Am I not looking in the right place for the problem? That is an insane error. tep_get_tax_rate is a function that is in includes/functions/general.php and that is loaded by application_top.php. You can check if it is not by accident commented out or something, but otherwise I'm in the dark too. Quote Link to comment Share on other sites More sharing options...
Guest Posted March 2, 2007 Share Posted March 2, 2007 James, With your productlisting.txt I could re-create that error. I don't really understand why it happened but there was a products_id = '' in the $select_list_of_prdct_ids that probably caused this to happen. I also saw that indeed it is a standard osC "feature" that if a product is in more than one category a search for a manufacturer will show up the product multiple times. I don't know if someone has come up with a better solution than the hack we are doing now, I would think so... Anyhow, this is what fixed it for me. Find around line 137 this piece of code and change it to this: while ($_listing = tep_db_fetch_array($listing_query)) { $_new_listing = array_merge($_listing , $default_settings); // in first iteration $_list_of_prdct_ids is not an array yet if (isset($_list_of_prdct_ids) && (!in_array($_new_listing['products_id'], $_list_of_prdct_ids))) { $listing[] = $_new_listing; $_list_of_prdct_ids[] = $_new_listing['products_id']; // if $_list_of_prdct_ids is not an array yet, the first item should be added } elseif (!isset($_list_of_prdct_ids)) { $listing[] = $_new_listing; $_list_of_prdct_ids[] = $_new_listing['products_id']; } } // end while ($_listing = tep_db_fetch_array($listing_query)) // no duplicate product_id's: $list_of_prdct_ids = array_unique($_list_of_prdct_ids); $no_of_listings = count($list_of_prdct_ids); // next part is a debug feature, when uncommented it will print the info that this module receives Dear JanZ Brilliant, Splendid, Excellent, Perfect......You are really a genius! :thumbsup: Thank you so much! :lol: You are the best. Please take my salute. James Quote Link to comment Share on other sites More sharing options...
hllbll Posted March 2, 2007 Share Posted March 2, 2007 See this post for fixes. Hi, Janz Thank you very much for your help. I still had to try editing my advanced_search_result.php -file few times before I got it to work. I don't know how that "manufacturer" section is working, 'cause I haven't defined any manufacturers yet. But now I know where I find the solution for that problem too. If it exists. Now I can backup my shop again and continue configuring it. Thank you again :) - Marko - Quote Link to comment Share on other sites More sharing options...
Guest Posted March 2, 2007 Share Posted March 2, 2007 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.