Guest Posted February 28, 2005 Share Posted February 28, 2005 I've now installed and got the contribution working :rolleyes: How do I prevent from displaying the original price with dashes through it? ?9.99---- ?19.99 An example of this is at: http://www.newlifehealthcare.co.uk/product...&products_id=39 Thanks, Alistair Quote Link to comment Share on other sites More sharing options...
lil_cheeks Posted February 28, 2005 Share Posted February 28, 2005 Please someone help me!!!! I installed the 1.4 version. From what i understand you only have to steps 1 and 2. I never installed any other versions. After i did steps 1 and 2 nothing changed. I left my prefix box blank and when i went to test it i added an item to my cart and it was subtracting the number instead. Please tel me what i am doing wrong. I really want this to work for me. I enter setps 1 and two in this file....catalog->includes->classes->shopping_cart.php. let me know if i am doing something wrong. thanks! Nick Quote Link to comment Share on other sites More sharing options...
crashwave Posted February 28, 2005 Share Posted February 28, 2005 I've now installed and got the contribution working :rolleyes: How do I prevent from displaying the original price with dashes through it? ?9.99---- ?19.99 An example of this is at: http://www.newlifehealthcare.co.uk/product...&products_id=39 Thanks, Alistair <{POST_SNAPBACK}> You installed the advanced part. There are TWO sets of steps 5-7. One is Simple and one is advanced. If you want Simple do only Simple steps 5-7. If you want advanced (claculations shown in cart/price crossed out) do Advanced steps 5-7. Sorry if that was confusing for anyone. I have updated install to explain in better. here http://www.dailywholesale.com/creloaded/Ad...Prices_1.4.html Quote q_|_|| _|9~~J >-o>-o q_|_|| )| q_|| ) Link to comment Share on other sites More sharing options...
crashwave Posted February 28, 2005 Share Posted February 28, 2005 Please someone help me!!!! I installed the 1.4 version. From what i understand you only have to steps 1 and 2. I never installed any other versions. After i did steps 1 and 2 nothing changed. I left my prefix box blank and when i went to test it i added an item to my cart and it was subtracting the number instead. Please tel me what i am doing wrong. I really want this to work for me. I enter setps 1 and two in this file....catalog->includes->classes->shopping_cart.php. let me know if i am doing something wrong. thanks!Nick <{POST_SNAPBACK}> You need to do ALL the steps 1-9 (so far) and only one of steps 5-7. steps 1 and 2 should have changed something. If you have never installed it before use http://www.dailywholesale.com/creloaded/Ad...Prices_1.4.html I am deleteing the other one because as far as I know everyone that had 1.3 made the fixes with no problem. Quote q_|_|| _|9~~J >-o>-o q_|_|| )| q_|| ) Link to comment Share on other sites More sharing options...
crashwave Posted March 1, 2005 Share Posted March 1, 2005 Got on email for "How to use instruction" 1-If you want a product to have the value of the attribute add the price with NO prefix. 2- If you want to add or subtract an amount from the products price place price and prefix you want (+ or -) 3-If you want the price unchanged from the products price (if you have different colors of a product and all are the same price) nothing in price and put a + in prefix (THAT IS IMPORTANT) 4- If you want the price to be $0 (download or something) place an 0 in price and NO prefix. (IMPORTANT) Hope that helps..Will add to instructions later. Quote q_|_|| _|9~~J >-o>-o q_|_|| )| q_|| ) Link to comment Share on other sites More sharing options...
lil_cheeks Posted March 1, 2005 Share Posted March 1, 2005 Ok. i went through 1-9 and still it didn't work. I must be missing somthing. Do you do steps 1 and 2 under catalog or admin or both? catalog->includes->classes->shopping_cart.php or admin->includes->classes->shopping_cart.php And is product_info.php under: catalog->product_info.php I think this is where i am messing up. Please help me just a little bit more. Thanks Nick Quote Link to comment Share on other sites More sharing options...
crashwave Posted March 1, 2005 Share Posted March 1, 2005 Ok. i went through 1-9 and still it didn't work. I must be missing somthing. Do you do steps 1 and 2 under catalog or admin or both?catalog->includes->classes->shopping_cart.php <{POST_SNAPBACK}> No changes in admin section. This is all in catalog. What is happening exactly? what is the site Quote q_|_|| _|9~~J >-o>-o q_|_|| )| q_|| ) Link to comment Share on other sites More sharing options...
lil_cheeks Posted March 1, 2005 Share Posted March 1, 2005 No changes in admin section.This is all in catalog. What is happening exactly? what is the site <{POST_SNAPBACK}> I'll try that. I have been doing things in the other one. I'll let you know how this turns out. Thanks! Quote Link to comment Share on other sites More sharing options...
DKarr Posted March 3, 2005 Share Posted March 3, 2005 I am trying to install and getting an error: Parse error: parse error, unexpected '}' in /home/premium/public_html/shop/includes/classes/shopping_cart.php on line 225 But am not good at php.... I thought I had copied everything correctly but I simply can not see it: can somebody please help???? Copied here is section of shopping_cart.php starting some lines about 225 and 225 is marked. function calculate() { $this->total = 0; $this->weight = 0; if (!is_array($this->contents)) return 0; reset($this->contents); while (list($products_id, ) = each($this->contents)) { $qty = $this->contents[$products_id]['qty']; // products price $product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'"); if ($product = tep_db_fetch_array($product_query)) { $prid = $product['products_id']; $products_tax = tep_get_tax_rate($product['products_tax_class_id']); $products_price = $product['products_price']; $products_weight = $product['products_weight']; line 225>(empty) $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']; } $this->total += tep_add_tax($products_price, $products_tax) * $qty; $this->weight += ($qty * $products_weight); } // phpmom.com advanced attribute price 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)$prid . "' 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'] == '+') { $this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax); } elseif ($attribute_price['price_prefix'] == '-') { $this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax); } elseif ($attribute_price['price_prefix'] == '') { //comment where you see //'0' if want '0' value // if ($attribute_price['options_values_price'] == '0') { //'0' // $this->total += 0; //'0' // } //'0' // if ($attribute_price['options_values_price'] != '0') { //'0' $this->total += tep_add_tax($attribute_price['options_values_price'], $products_tax) * $qty - (tep_add_tax($products_price, $products_tax) * $qty); // }//'0' ?}else $this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax); } } //PHPMOM.COM AAP 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']; } elseif ($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() { global $languages_id; if (!is_array($this->contents)) return false; ********************************************** Thank you! Quote At least 90% of my programming problems lie somewhere between my keyboard and my chair. Link to comment Share on other sites More sharing options...
crashwave Posted March 3, 2005 Share Posted March 3, 2005 am trying to install and getting an error: Parse error: parse error, unexpected '}' in /home/premium/public_html/shop/includes/classes/shopping_cart.php on line 225 error and the code you gave make no sense. Zip your file, upload it to your server and message me the link. Message to ALL that have this on their site. if you are using simple method Please check this for me Add a product that has two attribute selections. one with an actual price change and one with no price(color/size) to the cart. check the price of the product (not the cart) in shopping_cart. Is it the price of the cart or a total of price and attribute. This is only happening to one site and I cannot seem to figure it out unless there is another contribution interfering. Thanks Quote q_|_|| _|9~~J >-o>-o q_|_|| )| q_|| ) Link to comment Share on other sites More sharing options...
crashwave Posted March 3, 2005 Share Posted March 3, 2005 (edited) Ok I found a bug. I got my previous problem (last post) to happen on my site. This happens with both advanced and simple method The problem If there is more than one attribute to select from AND one of the selected has no prefx (actual price) AND the LAST selected attribute has a prefix (whether + or -) the products price in the shopping cart will add or subtract the total attribute price and will NOT be the same as the shopping_cart price. The total in the cart will be correct but the individual product price shown in cart will not. To remedy this for now in catalog/shopping_cart.php comment out the part that shows the products price (do not delete it this is a temp fix till I fix the bug) change 'text' => '<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</b>'); to ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'text' => ''/*'<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</b>'*/); OR you can rearange you attributes so the last one does not have a prefix. I'll try to get this fixed as soon as I can Edited March 3, 2005 by crashwave Quote q_|_|| _|9~~J >-o>-o q_|_|| )| q_|| ) Link to comment Share on other sites More sharing options...
crashwave Posted March 7, 2005 Share Posted March 7, 2005 Ok I got the fix. first-If you commented the total column uncomment it. Unfortunately for now ADVANCED method will not work. I migth try and get an advanced fix for this later but now I just do not know how it will work. complete new instructions http://www.dailywholesale.com/creloaded/Ad...rices_1.41.html classes/shopping_cart TO REMOVE function attributes_prefix($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_prefix_query = tep_db_query("select price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'"); $attribute_prefix = tep_db_fetch_array($attribute_prefix_query); $attributes_prefix = $attribute_prefix['price_prefix']; } } return $attributes_prefix; } ---------------- if you have if (isset($this->contents[$products_id]['attributes'])) { if ($this->attributes_prefix($products_id) == ''){ $the_final_price = $this->attributes_price($products_id); } else $the_final_price = ($products_price + $this->attributes_price($products_id)); }else $the_final_price = ($products_price); //eof actual attribute//hadir ----------------- if you have final_price' => $the_final_price, ---------------- if you have 'final_price' => $products_price, //hadir//see cart 'attrib_price' => $this->attributes_price($products_id), 'attrib_prefix' => $this->attributes_prefix($products_id), //eof --------------- TO ADD above $products_array[] = array('id' => $products_id, add $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']-$products_price); } elseif ($attribute_price['price_prefix'] == '+') { $attributes_price += $attribute_price['options_values_price']; } elseif ($attribute_price['price_prefix'] == '-') { $attributes_price -= $attribute_price['options_values_price']; } } } and change or add (make sure there is only one) final_price=> under 'weight' => $products['products_weight'] to 'final_price' => ($products_price + $attributes_price), 'attributes_price' => $attributes_price, +++++++++++++++++++++++++++++++++ in classes/order.php REMOVE if (isset($cart->contents[$products[$i]['id']]['attributes'])) { if ($cart->attributes_prefix($products[$i]['id']) == ''){ $the_final_price = $cart->attributes_price($products[$i]['id']); } else $the_final_price = ($products[$i]['price'] + $cart->attributes_price($products[$i]['id'])); }else $the_final_price = ($products[$i]['price']); and under that CHANGE 'final_price' =>...... to 'attributes_price'=>$products[$i]['attributes_price'], 'final_price' => $products[$i]['final_price'], ----------------- for customer groups only remove if (isset($cart->contents[$products[$i]['id']]['attributes'])) {//fix 1.3.4 if ($cart->attributes_prefix($products[$i]['id']) == ''){ $grp_final_price = $cart->attributes_price($products[$i]['id']); } else $grp_final_price = ($orders_customers['customers_group_price'] + $cart->attributes_price($products[$i]['id'])); }else $grp_final_price = ($orders_customers['customers_group_price']); and under that CHANGE 'final_price' =>...... to 'final_price' => $products[$i]['final_price']); ------------------ +++++++++++++++++ If you were using Advanced mathod in catalog/shopping_cart.php (or template/shopping_cart) REMOVE if ($products[$i]['attrib_price'] != 0){ if ($products[$i]['attrib_prefix'] == '-') { $new_att_price =str_replace('-','',$products[$i]['attrib_price']); $attrib_added = '<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) .'</b><br /><i>-'. $currencies->display_price(round($new_att_price,2), tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']).'</i>'; } elseif ($products[$i]['attrib_prefix'] == '') { $attrib_added = '<b><s>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) .'</s></b><br /><i>'. $currencies->display_price(round($products[$i]['attrib_price'],2), tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']).'</i>'; } else $attrib_added = '<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) .'</b><br /><i>'. $products[$i]['attrib_prefix'].$currencies->display_price(round($products[$i]['attrib_price'],2), tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']).'</i>'; } elseif (($products[$i]['attrib_prefix'] == '')&&($products[$i]['attrib_price'] == 0)) { $attrib_added = '<b><s>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) .'</s></b><br /><i>'. $currencies->display_price(round($products[$i]['attrib_price'],2), tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']).'</i>'; } else $attrib_added = '<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) .'</b>'; //eof view calculation// and under that change 'text' => $attrib_added to 'text' => '<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) . '</b>' Quote q_|_|| _|9~~J >-o>-o q_|_|| )| q_|| ) Link to comment Share on other sites More sharing options...
NJTackle Posted March 11, 2005 Share Posted March 11, 2005 :'( Got this installed but won't work with the 'new attribute manager' contribution. Does anybody have this installed and working with this mode? New attribute manager : http://www.oscommerce.com/community/contri...tribute+manager The problem is the attribute manager only has the + and - as an option....no " " (space). Any idea how to add this? Thanks!!! Quote Link to comment Share on other sites More sharing options...
crashwave Posted March 12, 2005 Share Posted March 12, 2005 The problem is the attribute manager only has the + and - as an option....no " " (space). important it is a blank "" not a space. Nothing in the attribute prefix. as far as manager goes you should be able to add it. wherever you see reference to the prefix (+ or -) add a line for "". Sorry wish I could help more. Quote q_|_|| _|9~~J >-o>-o q_|_|| )| q_|| ) Link to comment Share on other sites More sharing options...
NJTackle Posted March 13, 2005 Share Posted March 13, 2005 (edited) important it is a blank "" not a space. Nothing in the attribute prefix. as far as manager goes you should be able to add it. wherever you see reference to the prefix (+ or -) add a line for "". Sorry wish I could help more. <{POST_SNAPBACK}> Thanks Crashwave! I'll try to hack this in after I get this running. The problem I have now is the amount is subtracted from the regular price instead of replacing the original cost. I have a "" (empty space) in the prefix field so don't know what's happening here. Seems as if its still using the "-" as default. Edited March 13, 2005 by NJTackle Quote Link to comment Share on other sites More sharing options...
NJTackle Posted March 13, 2005 Share Posted March 13, 2005 Thanks Crashwave! I'll try to hack this in after I get this running. The problem I have now is the amount is subtracted from the regular price instead of replacing the original cost. I have a "" (empty space) in the prefix field so don't know what's happening here. Seems as if its still using the "-" as default. <{POST_SNAPBACK}> :rolleyes: I've been working at this shopping cart too long!!! I made changes to the shopping_cart.php in admin and not catalog......sorry! Works fine now! Thanks!!!!! :thumbsup: Quote Link to comment Share on other sites More sharing options...
crashwave Posted March 14, 2005 Share Posted March 14, 2005 Actual Attribute for Easy populate If you are using easy populate this will allow you to add the actual attributes I don't knowif everyone is using the same easy populat so I am going to add the whole sections I edited you will see //hadir where I edited this is form line 336-397 // If you have other modules that need to be available, put them here // VJ product attribs begin //start hadir @phpmom.com show attrib only $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$row['v_products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'"); $products_attributes = tep_db_fetch_array($products_attributes_query); if ($products_attributes['total'] > 0) { //end show attrib only if (isset($filelayout['v_attribute_options_id_1'])){ $languages = tep_get_languages(); $attribute_options_count = 1; foreach ($attribute_options_array as $attribute_options) { $row['v_attribute_options_id_' . $attribute_options_count] = $attribute_options['products_options_id']; for ($i=0, $n=sizeof($languages); $i<$n; $i++) { $lid = $languages[$i]['id']; $attribute_options_languages_query = "select products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . (int)$attribute_options['products_options_id'] . "' and language_id = '" . (int)$lid . "'"; $attribute_options_languages_values = tep_db_query($attribute_options_languages_query); $attribute_options_languages = tep_db_fetch_array($attribute_options_languages_values); $row['v_attribute_options_name_' . $attribute_options_count . '_' . $lid] = $attribute_options_languages['products_options_name']; } $attribute_values_query = "select products_options_values_id from " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " where products_options_id = '" . (int)$attribute_options['products_options_id'] . "' order by products_options_values_id"; $attribute_values_values = tep_db_query($attribute_values_query); $attribute_values_count = 1; while ($attribute_values = tep_db_fetch_array($attribute_values_values)) { $row['v_attribute_values_id_' . $attribute_options_count . '_' . $attribute_values_count] = $attribute_values['products_options_values_id']; $attribute_values_price_query = "select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$row['v_products_id'] . "' and options_id = '" . (int)$attribute_options['products_options_id'] . "' and options_values_id = '" . (int)$attribute_values['products_options_values_id'] . "'"; $attribute_values_price_values = tep_db_query($attribute_values_price_query); $attribute_values_price = tep_db_fetch_array($attribute_values_price_values); //hadir AAP $row['v_attribute_values_price_' . $attribute_options_count . '_' . $attribute_values_count] = $attribute_values_price['price_prefix'] . $attribute_values_price['options_values_price']; $row['v_attribute_values_price_' . $attribute_options_count . '_' . $attribute_values_count] = $attribute_values_price['options_values_price']; //hadir actual attribute $row['v_attribute_values_price_' . $attribute_options_count . '_' . $attribute_values_count.'_prefix'] = $attribute_values_price['price_prefix']; //hadir actual attribute for ($i=0, $n=sizeof($languages); $i<$n; $i++) { $lid = $languages[$i]['id']; $attribute_values_languages_query = "select products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . (int)$attribute_values['products_options_values_id'] . "' and language_id = '" . (int)$lid . "'"; $attribute_values_languages_values = tep_db_query($attribute_values_languages_query); $attribute_values_languages = tep_db_fetch_array($attribute_values_languages_values); $row['v_attribute_values_name_' . $attribute_options_count . '_' . $attribute_values_count . '_' . $lid] = $attribute_values_languages['products_options_values_name']; } $attribute_values_count++; } $attribute_options_count++; } } }//hadir phpmom.com // VJ product attribs end line 1325 -1344 $attribute_values_count = 1; while ($attribute_values = tep_db_fetch_array($attribute_values_values)) { $key3 = 'v_attribute_values_id_' . $attribute_options_count . '_' . $attribute_values_count; $header_array[$key3] = $iii++; $key4 = 'v_attribute_values_price_' . $attribute_options_count . '_' . $attribute_values_count.'_prefix'; //hadir AAP $header_array[$key4] = $iii++; $key5 = 'v_attribute_values_price_' . $attribute_options_count . '_' . $attribute_values_count; //Hadir AAP $header_array[$key5] = $iii++; //Hadir AAP for ($i=0, $n=sizeof($languages); $i<$n; $i++) { $l_id = $languages[$i]['id']; $key6 = 'v_attribute_values_name_' . $attribute_options_count . '_' . $attribute_values_count . '_' . $l_id; //Hadir AAP $header_array[$key6] = $iii++; //Hadir AAP } $attribute_values_count++; } line 2202-2218 // options_values price update begin $v_attribute_values_price_var = 'v_attribute_values_price_' . $attribute_options_count . '_' . $attribute_values_count; $v_attribute_values_prefix_var = 'v_attribute_values_price_' . $attribute_options_count . '_' . $attribute_values_count.'_prefix';//hadir//actual attrib if (isset($$v_attribute_values_price_var) && ($$v_attribute_values_price_var != '')) { $attribute_prices_query = "select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$v_products_id . "' and options_id ='" . (int)$$v_attribute_options_id_var . "' and options_values_id = '" . (int)$$v_attribute_values_id_var . "'"; $attribute_prices_values = tep_db_query($attribute_prices_query); //hadir AAP $attribute_values_price_prefix = ($$v_attribute_values_price_var < 0) ? '-' : '+'; //start hadir.net actual attrib price if (($$v_attribute_values_prefix_var == '-') || ($$v_attribute_values_prefix_var == '+')||(!$$v_attribute_values_prefix_var)){ $attribute_values_price_prefix = $$v_attribute_values_prefix_var;} else $attribute_values_price_prefix = '+'; //end hadir.net actual attrib // options_values_prices table update begin // insert into options_values_prices table if no price exists Quote q_|_|| _|9~~J >-o>-o q_|_|| )| q_|| ) Link to comment Share on other sites More sharing options...
RoninS14 Posted March 18, 2005 Share Posted March 18, 2005 I'm sorry for being so rude and ask for such a thing, but could someone please tabulate the code for me so that when I cut and paste it to install it in the required files, it will be tabbed correctly. I did everything this asked me to do but when I go to my catalog, it returns a blank page. I'm pretty sure I did it correctly, but when I look at the code in the shopping_cart.php it is not tabbed like the other parts of the codes already there. I have attempted to tabulate the code myself, but I have been unsuccessful at doing so, seeing as I am not that proficient in php at all. I would really appreciate any help if given... Sincerely, Randy CLASS/SHOPPING_CART.PHP 1-Under $this->weight += ($qty * $products_weight); } REMOVE EVERYTHING THAT HAS TO DO WITH ATTRIBUTES and add this // phpmom.com advanced attribute price 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)$prid . "' 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'] == '+') { $this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax); } elseif ($attribute_price['price_prefix'] == '-') { $this->total -= $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax); } elseif ($attribute_price['price_prefix'] == '') { //comment where you see //'0' if want '0' value // if ($attribute_price['options_values_price'] == '0') { //'0' // $this->total += 0; //'0' // } //'0' // if ($attribute_price['options_values_price'] != '0') { //'0' $this->total += tep_add_tax($attribute_price['options_values_price'], $products_tax) * $qty - (tep_add_tax($products_price, $products_tax) * $qty); // }//'0' }else $this->total += $qty * tep_add_tax($attribute_price['options_values_price'], $products_tax); } } there should be two } after that ////////////////////////////////////////////////// 2-For the function attributes_price($products_id) Delete the whole thing and add this //PHPMOM.COM AAP 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']; } elseif ($attribute_price['price_prefix'] == '-') { $attributes_price -= $attribute_price['options_values_price']; } else $attributes_price+= $attribute_price['options_values_price']; } } return $attributes_price; } //////////////////////////////////////////////////////////////////////// 3-To display '0' values change this in Product_info.php (Or product_info.tpl.php for template/loaded) Change if ($products_options['options_values_price'] != '0') { to //BOF PHPMOM.COM AAP if (($products_options['options_values_price'] != '0')||(($products_options['options_values_price'] == '0')&&($products_options['price_prefix'] == ''))) { //eof aap /////////////////////////////////////////////////////////////// 4-clases/shopping_cart under return $attributes_price; } Add this //BOF PHPMOM.COM AAP function attributes_prefix($products_id) { if (isset($this->contents[$products_id]['attributes'])) { reset($this->contents[$products_id]['attributes']); while (list($option, $value) = each($this->contents[$products_id]['attributes'])) { $attribute_prefix_query = tep_db_query("select price_prefix from ". TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id ."' and options_id = '" . (int)$option . "' and options_values_id = '" .(int)$value . "'"); $attribute_prefix = tep_db_fetch_array($attribute_prefix_query); $attributes_prefix = $attribute_prefix['price_prefix']; } } return $attributes_prefix; }//eof aap ////////////////////////////////////////////////////////////// this is two part Simple and Advanced Simple Methods in shopping_cart Displays the products price with attribute changes in the products row like it does normally. Advance displays the actual products price (no attribut changes) with the attribute calculation underneath the price. For instance if product price $10 and attribute price $9 it will show like this $10 $9 if attribute 1 is (-2) and attribute 2 is (-3) it will display like this $10 -$5 Anyway here is the fix DO NOT DO BOTH SETS OF STEPS 5-7. Either do Simple or Advanced. SIMPLE 5-7 (I am not using so PLEASE email if this does not work correctly) 5-in classes/shopping_cart.php above $products_array[] = array('id' => $products_i add //BOF PHPMOM.COM AAP//hadir if (isset($this->contents[$products_id]['attributes'])) { if ($this->attributes_prefix($products_id) == ''){ $the_final_price = $this->attributes_price($products_id); } else $the_final_price = ($products_price + $this->attributes_price($products_id)); }else $the_final_price = ($products_price); //eof actual attribute//hadir 6- then find 'final_price' => and change it's value to 'final_price' => $the_final_price, //PHPMOM.COM AAP 7-Take a break END SIMPLE ////////////////////////////////////////////////////////// ADVANCED steps 5-7 5-then find in the function get_products() { 'final_price' => ( Replace with //BOF PHPMOM.COM AAP 'final_price' => ($products_price + $this->attributes_price($products_id)), 'final_price' => $products_price, //hadir//see cart 'attrib_price' => $this->attributes_price($products_id), 'attrib_prefix' => $this->attributes_prefix($products_id), //eof 6-In catalog/shopping_cart.php or shopping_cart.tpl.php if template/loaded Find $info_box_contents[$cur_row][] = array('align' => 'right', 'params' => 'class="productListing-data" valign="top"', 'text' => '<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) .. '</b>'); (or similar we are trying to find where the price is displayed final_price) And ABOVE IT add //BOF PHPMOM.COM AAP View Attribute Calculation in shopping cart if ($products[$i]['attributes']){ if ($products[$i]['attrib_price'] != 0){ if (strstr($products[$i]['attrib_price'],'-')){ $new_att_price =str_replace('-','',$products[$i]['attrib_price']); $products[$i]['attrib_prefix'] = '-';} if ($products[$i]['attrib_prefix'] == '-') { $attrib_added = '<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) .'</b><br /><i>-'. $currencies->display_price(round($new_att_price,2), tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']).'</i>'; } elseif ($products[$i]['attrib_prefix'] == '') { $attrib_added = '<b><s>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) .'</s></b><br /><i>'. $currencies->display_price(round($products[$i]['attrib_price'],2), tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']).'</i>'; } else $attrib_added = '<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) .'</b><br /><i>'. $products[$i]['attrib_prefix'].$currencies->display_price(round($products[$i]['attrib_price'],2), tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']).'</i>'; } elseif (($products[$i]['attrib_prefix'] == '')&&($products[$i]['attrib_price'] == 0)) { $attrib_added = '<b><s>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) .'</s></b><br /><i>'. $currencies->display_price(round($products[$i]['attrib_price'],2), tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']).'</i>'; }else $attrib_added = '<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) .'</b>'; }else $attrib_added = '<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) .'</b>'; //eof View Attribute Calculation//hadir 7-Then change 'text' => '<b>' . $currencies->display_price($products[$i]['final_price'], tep_get_tax_rate($products[$i]['tax_class_id']), $products[$i]['quantity']) .. '</b>'); To 'text' => $attrib_added); //hadir//view calculation END ADVANCE //////////////////////////////////////////////////// If you have the customer pricing contribution do 8, 9, and 9a, 9b if not just do 8 and 9 8-In Classes/order.php above $this->products[$index] = array('qty' => $products[$i]['quantity'], Add //BOF PHPMOM.COM AAP if (isset($cart->contents[$products[$i]['id']]['attributes'])) { if ($cart->attributes_prefix($products[$i]['id']) == ''){ $the_final_price = $cart->attributes_price($products[$i]['id']); } else $the_final_price = ($products[$i]['price'] + $cart->attributes_price($products[$i]['id'])); }else $the_final_price = ($products[$i]['price']); //eof actual attribute//hadir /////////////////////////////// 9-Change 'final_price' => $products[$i]['price'] + $cart->attributes_price($products[$i]['id']), To 'final_price' => $the_final_price, //PHPMOM.COM AAP ///////////////////////////////////////////////////////// 9a- for customer group pricing only under if ($orders_customers = tep_db_fetch_array($orders_customers_price)) { add //BOF PHPMOM.COM AAP//hadir if (isset($cart->contents[$products[$i]['id']]['attributes'])) { if ($cart->attributes_prefix($products[$i]['id']) == ''){ $grp_final_price = $cart->attributes_price($products[$i]['id']); } else $grp_final_price = ($orders_customers['customers_group_price'] + $cart->attributes_price($products[$i]['id'])); }else $grp_final_price = ($products[$i]['price']); //eof actual attribute//hadir //eof //////////////////////////////////////// 9b-for customer group pricing only Change 'final_price' => $orders_customers['customers_group_price'] + $cart->attributes_price($products[$i]['id'])); to 'final_price' => $grp_final_price); //PHPMOM.COM AAP //////////////////////////////////////////////////// Quote Link to comment Share on other sites More sharing options...
RoninS14 Posted March 19, 2005 Share Posted March 19, 2005 I edited both catalog/shopping_cart.php and catalog/include/classes/shopping_cart.php what am I doing wrong if nothing displays when I access my website. I just get a blank page. Its a good thing I backed up my original "shopping_cart.php" in both catalog and classes before modifying the codes in both. Now its back to normal, but I would really like to get this contribution to work. I am using the latest version of ez populate, but I currently only have 1 item in my store since I am still setting it up. I don't think my previous post has anything to do with it. But I could still be wrong. Quote Link to comment Share on other sites More sharing options...
RoninS14 Posted March 22, 2005 Share Posted March 22, 2005 ok, forgive my squirrelly ignorance but I got it work. It was an error on my part...nothing to do with anything I stated above. Now my next question is in regard to editing the weight along with the price. You see, I sell fabric and hula skirts. And am able to make skirts out of the fabric I sell. So instead of creating two categories: one for fabric and one for hula skirts. I thought I'd make things easy for me and my customers, by having only a main categories for both, fabric by the yards, and skirts. Now this contribution works great at doing what it does, and I love it. But since the original weight is assigned to 1 yard of fabric, and it take 4 yards to make a hula skirt, I was wondering how I could go about adding that extra 3 yards of fabric in the weight calculation for shipping. Right now, when the customer orders a pa'u skirt, he or she is only charged for the shipping of 1 yard of fabric. so I have to charge the customer a second time for the shipping fee that was not calculated. Quote Link to comment Share on other sites More sharing options...
RoninS14 Posted March 22, 2005 Share Posted March 22, 2005 ok scratch what I said above again. I have to thank the geniuses who code php and make this world and better place for us to be in. I found out about everything I needed. Thank you all for such great contributions!!! :thumbsup: Quote Link to comment Share on other sites More sharing options...
ukjosephineuk Posted April 5, 2005 Share Posted April 5, 2005 (edited) Thanks for all your hard work on this contribution. :thumbsup: Do you think it will be long before this can be used with the Add Weight To Product Attributes v0.1 or is this option available already and i havent found it yet! I'm going to try and figure it myself but as a total newbie i fear that I have no chance. Any help would be greatly appreciated. Edited April 5, 2005 by ukjosephineuk Quote Link to comment Share on other sites More sharing options...
gecko Posted April 11, 2005 Share Posted April 11, 2005 Do you think it will be long before this can be used with the Add Weight To Product Attributes v0.1 or is this option available already and i havent found it yet! <{POST_SNAPBACK}> I would like to find out how to do this too. can anyone help? i'm sure i have read all my way through this forum with no luck yet. Version 1.41 also misses a reference to order.php(i think) which you can find in previous version. Gecko Quote this time it'll go :-) Link to comment Share on other sites More sharing options...
gecko Posted April 12, 2005 Share Posted April 12, 2005 I have this working well thanks to all of you. Now does anyone know how to get the atribute drop down menu in the order you want. Or how to set the default to show. i have 4 attributes in sizes a, b,c,d and i would like the menu to show a by default when you veiw the product, and then the drop down menu to show b,c,d in order. any Ideas??. Also is there anyone who could take the time to see if they can get the contribution add-weight-to-products-attributes- to fit in this contribution. i have had a good look and it's close to do-able but i'm not good enough to get it together. Any help would be great and i think it would really help this contribution. Quote this time it'll go :-) Link to comment Share on other sites More sharing options...
gecko Posted April 13, 2005 Share Posted April 13, 2005 Okay i have found the answer to getting the attibutes in the right order (i think) i used this contribution Products Attributes Sort v1.0 It just changes some code in catalog/product_info.php and sets your atributes nicely in order i have it working well. Still trying to find out how to add weight to Actual Attribute Price. Would anybody be prepared to chip in to pay someone to write this mod?. Quote this time it'll go :-) 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.