PupStar Posted March 6, 2011 Share Posted March 6, 2011 Hi Guys, Many thanks to all who have helped me out so far along my epic journey :thumbsup: What I am trying to do now is replace the price and the quantity input field in my product listing with 'Call for Price' if the products price is 0.00 but leave the fields as they are if the products price is greater than 0.00 The code I currently have is case 'PRODUCT_LIST_PRICE': if (tep_not_null($listing['specials_new_products_price'] > '0')) { $prod_list_contents .= ' <td width="20%" align="center"><del>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</del> <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span></td>'; } else { $prod_list_contents .= ' <td width="20%" align="center">' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</td>'; } break; case 'PRODUCT_LIST_BUY_NOW': if (tep_not_null($listing['specials_new_products_price'] > '0')) { $prod_list_contents .= '<td width="20%" align="left">' . TEXT_QTY . ' <input type="text" name="add_id['.$number_of_products.']" value="" size="4">'; $prod_list_contents .= '<input type="hidden" name="products_id['.$number_of_products.']" value="'.$listing['products_id'].'"></td><td width="2px"> </td>'; }else{ $prod_list_contents .= '<td width="20%" align="left">' . TEXT_QTY . ' <input type="text" name="add_id['.$number_of_products.']" value="" size="4">'; $prod_list_contents .= '<input type="hidden" name="products_id['.$number_of_products.']" value="'.$listing['products_id'].'"></td><td width="px"> </td>'; } break; Can this be done with a simple if/else statement and if so how? Thanks Mark Link to comment Share on other sites More sharing options...
pyramids Posted March 6, 2011 Share Posted March 6, 2011 Have you tried this mod? Easy Call for Price 2.3.1-ver1.0 http://addons.oscommerce.com/info/7787 Link to comment Share on other sites More sharing options...
PupStar Posted March 6, 2011 Author Share Posted March 6, 2011 Have you tried this mod? Easy Call for Price 2.3.1-ver1.0 http://addons.oscommerce.com/info/7787 Hi Jeff, Yeah I already tried that but it did not really do what I wanted, may have to give it another go if that turns out to be the only solution. Mark Link to comment Share on other sites More sharing options...
Guest Posted March 7, 2011 Share Posted March 7, 2011 Deleted Chris Link to comment Share on other sites More sharing options...
PupStar Posted March 8, 2011 Author Share Posted March 8, 2011 Hi Guys, Just to give an update. I have succeeded in my task this time woohoo I changed the above code to: case 'PRODUCT_LIST_PRICE': if (tep_not_null($listing['specials_new_products_price'] > '0')) { $prod_list_contents .= '<td width="20%" align="center"><del>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</del> <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span></td>'; } else if ($listing['products_price'] == 0){ $prod_list_contents .= '<td width="20%" align="center" colspan="2"><a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . TEXT_CALL_FOR_PRICE . '</a></td>'; } else { $prod_list_contents .= '<td width="20%" align="center">' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</td>'; } break; case 'PRODUCT_LIST_BUY_NOW': if (tep_not_null($listing['products_price'] > '0')) { $prod_list_contents .= '<td width="20%" align="left">' . TEXT_QTY . ' <input type="text" name="add_id['.$number_of_products.']" value="" size="4">'; $prod_list_contents .= '<input type="hidden" name="products_id['.$number_of_products.']" value="'.$listing['products_id'].'"></td><td width="2px"> </td>'; }else{ $prod_list_contents .= ' '; } break; And again woohoo (w00t) Regards Mark Link to comment Share on other sites More sharing options...
Xpajun Posted March 8, 2011 Share Posted March 8, 2011 Mark, you might want to put a lock in to stop anyone ordering a "call for price" item for free ;) My store is currently running Phoenix 1.0.3.0 I'm currently working on 1.0.7.2 and hope to get it live before 1.0.8.0 arrives (maybe 🙄 ) I used to have a list of add-ons here but I've found that with the ones that supporters of Phoenix get any other add-ons are not really neccessary Link to comment Share on other sites More sharing options...
PupStar Posted March 8, 2011 Author Share Posted March 8, 2011 Mark, you might want to put a lock in to stop anyone ordering a "call for price" item for free ;) Yeah I did have that nagging in the back of my mind but unsure on how to do it. Link to comment Share on other sites More sharing options...
Xpajun Posted March 8, 2011 Share Posted March 8, 2011 Yeah I did have that nagging in the back of my mind but unsure on how to do it. Another if/else statement on the BUY button maybe... My store is currently running Phoenix 1.0.3.0 I'm currently working on 1.0.7.2 and hope to get it live before 1.0.8.0 arrives (maybe 🙄 ) I used to have a list of add-ons here but I've found that with the ones that supporters of Phoenix get any other add-ons are not really neccessary Link to comment Share on other sites More sharing options...
PupStar Posted March 8, 2011 Author Share Posted March 8, 2011 Another if/else statement on the BUY button maybe... sorry for being a numpty but what logic is going to be required I have tried this (I know it does not work, getting tired now as its being a long day at the day job lol) <?php if ($listing['products_price'] > '0') { ?> <div class="contentContainer"> <div class="buttonSet" style="padding:8px;"> <span class="buttonAction"><?php echo TEXT_ENTER_QUANTITY . TEXT_YOU_REQUIRE . ' ' . tep_draw_button('Add to basket', IMAGE_BUTTON_IN_CART); ?></span> </div> </div> </form> <?php }else{ ?> <div class="contentContainer"> <div class="buttonSet" style="padding:8px;"> <span class="buttonAction"> </span> </div> </div> <?php } ?> Link to comment Share on other sites More sharing options...
PupStar Posted March 11, 2011 Author Share Posted March 11, 2011 Still not managed this, any suggestions welcomed please Julian. Thanks Mark Link to comment Share on other sites More sharing options...
detoner Posted July 21, 2011 Share Posted July 21, 2011 Hi Jeff, Yeah I already tried that but it did not really do what I wanted, may have to give it another go if that turns out to be the only solution. Mark How did you get this working? According to the documentation it tells you to change catalog/includes/modules/product_listing.php FIND: case 'PRODUCT_LIST_BUY_NOW': $lc_text = TABLE_HEADING_BUY_NOW; $lc_align = 'center'; break; REPLACE WITH: case 'PRODUCT_LIST_BUY_NOW': // BOF: MOD - EASY CALL FOR PRICE 2.3.1v1.0 if ($listing['products_price']> '0') //fix for call for price $lc_text = TABLE_HEADING_BUY_NOW; else $lc_text = ' '; // EOF: MOD - EASY CALL FOR PRICE 2.3.1v1.0 $lc_align = 'center'; break; FIND: case 'PRODUCT_LIST_BUY_NOW': $prod_list_contents .= ' <td align="center">' . tep_draw_button(IMAGE_BUTTON_BUY_NOW, 'cart', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id'])) . '</td>'; break; REPLACE WITH: case 'PRODUCT_LIST_BUY_NOW': // BOF: MOD - EASY CALL FOR PRICE 2.3.1v1.0 if ($listing['products_price']> '0') //fix for call for price // EOF: MOD - EASY CALL FOR PRICE 2.3.1v1.0 $prod_list_contents .= ' <td align="center">' . tep_draw_button(IMAGE_BUTTON_BUY_NOW, 'cart', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id'])) . '</td>'; break; * SAVE AND CLOSE FILE but this code does not exist in 2.3.1 - this code is what you find if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) { $lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text); $prod_list_contents .= ' '.$lc_text.' ' ; Link to comment Share on other sites More sharing options...
detoner Posted August 21, 2011 Share Posted August 21, 2011 sorry for being a numpty but what logic is going to be required I have tried this (I know it does not work, getting tired now as its being a long day at the day job lol) <?php if ($listing['products_price'] > '0') { ?> <div class="contentContainer"> <div class="buttonSet" style="padding:8px;"> <span class="buttonAction"><?php echo TEXT_ENTER_QUANTITY . TEXT_YOU_REQUIRE . ' ' . tep_draw_button('Add to basket', IMAGE_BUTTON_IN_CART); ?></span> </div> </div> </form> <?php }else{ ?> <div class="contentContainer"> <div class="buttonSet" style="padding:8px;"> <span class="buttonAction"> </span> </div> </div> <?php } ?> found a fixto shop the cart appearing when item is set to zero in the shop - edit the product_info.php file <div class="buttonSet"> <span class="buttonAction"> <?php if ($product_info['products_price'] > 0 ) { ?> <?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', null, 'primary', null, '1'); ?> <?php } else { ?> <td align="right"></td> <?php } ?> </span> Link to comment Share on other sites More sharing options...
detoner Posted August 24, 2011 Share Posted August 24, 2011 and in includes/classes/currency.php replace function display_price($products_price, $products_tax, $quantity = 1) { return $this->format(tep_add_tax($products_price, $products_tax) * $quantity); with this code function display_price($products_price, $products_tax, $quantity = 1) { if ($products_price > 0){ return $this->format(tep_add_tax($products_price, $products_tax) * $quantity); }else{ return "Price On Application"; } } } Only 2 file edits are required Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.