Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

Assistance required to hide price and replace with text link


12 replies to this topic

#1 PupStar

  • Community Member
  • 397 posts
  • Real Name:Mark
  • Gender:Male

Posted 06 March 2011, 15:29

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

[img]http://i56.tinypic.com/976stk.jpg[/img]

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>&nbsp;&nbsp;<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 . '&nbsp;<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">&nbsp;</td>';
            }else{
            $prod_list_contents .= '<td width="20%" align="left">' . TEXT_QTY . '&nbsp;<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">&nbsp;</td>';
           }
           break;

Can this be done with a simple if/else statement and if so how?

Thanks

Mark
My Contributions (so far):

Join Us On Facebook & Twitter Infobox

Contributions currently installed into osCommerce 2.3.1

  • Ajax Attributes Manager
  • CKEditor
  • Column Listing with smart column (modified)
  • Documents Manager
  • Easy Map
  • EasyPopulate v2_76i_231
  • Mindsparx Specials
  • Mindsparx Admin
  • OTF Auto Thumbnailer v2.4
  • Star Product v1.6 + Mindsparx Pimped version
  • Ultimate SEO Urls
  • Who's Online Enhancement
  • Printer Filter V1.7 (modified)
  • Info Pages Unlimited v2.07
  • Google Feeder V2.6
  • Year Make Model

#2 pyramids

  • Community Member
  • 380 posts
  • Real Name:Jeff
  • Gender:Male
  • Location:Pennsylvania

Posted 06 March 2011, 19:46

Have you tried this mod?
Easy Call for Price 2.3.1-ver1.0

http://addons.oscommerce.com/info/7787

#3 PupStar

  • Community Member
  • 397 posts
  • Real Name:Mark
  • Gender:Male

Posted 06 March 2011, 20:40

View Postpyramids, on 06 March 2011, 19:46, said:

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
My Contributions (so far):

Join Us On Facebook & Twitter Infobox

Contributions currently installed into osCommerce 2.3.1

  • Ajax Attributes Manager
  • CKEditor
  • Column Listing with smart column (modified)
  • Documents Manager
  • Easy Map
  • EasyPopulate v2_76i_231
  • Mindsparx Specials
  • Mindsparx Admin
  • OTF Auto Thumbnailer v2.4
  • Star Product v1.6 + Mindsparx Pimped version
  • Ultimate SEO Urls
  • Who's Online Enhancement
  • Printer Filter V1.7 (modified)
  • Info Pages Unlimited v2.07
  • Google Feeder V2.6
  • Year Make Model

#4 DunWeb

  • Community Sponsor
  • 10,464 posts
  • Real Name:Chris Dunn
  • Gender:Male
  • Location:Tecumseh, Ontario, Canada N8N 1X8

Posted 07 March 2011, 00:28

Deleted



Chris

Edited by DunWeb, 07 March 2011, 00:28.

:|: Was this post helpful ? Click the LIKE THIS button :|:

:|: Click Here to learn how I can help you with custom coding, add ons, security and templates :|:

:|: Need an Area Calculator, Pre-Paid Account, Virtual Pin, Auction or Layaway Add on ? Click Here :|:

#5 PupStar

  • Community Member
  • 397 posts
  • Real Name:Mark
  • Gender:Male

Posted 08 March 2011, 21:19

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>&nbsp;&nbsp;<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 . '&nbsp;<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">&nbsp;</td>';
            }else{
            $prod_list_contents .= '&nbsp;';
           }
           break;

And again woohoo (w00t)

Regards

Mark
My Contributions (so far):

Join Us On Facebook & Twitter Infobox

Contributions currently installed into osCommerce 2.3.1

  • Ajax Attributes Manager
  • CKEditor
  • Column Listing with smart column (modified)
  • Documents Manager
  • Easy Map
  • EasyPopulate v2_76i_231
  • Mindsparx Specials
  • Mindsparx Admin
  • OTF Auto Thumbnailer v2.4
  • Star Product v1.6 + Mindsparx Pimped version
  • Ultimate SEO Urls
  • Who's Online Enhancement
  • Printer Filter V1.7 (modified)
  • Info Pages Unlimited v2.07
  • Google Feeder V2.6
  • Year Make Model

#6 Xpajun

  • Community Member
  • 1,272 posts
  • Real Name:Julian
  • Gender:Male
  • Location:UK

Posted 08 March 2011, 22:23

Mark, you might want to put a lock in to stop anyone ordering a "call for price" item for free ;)

#7 PupStar

  • Community Member
  • 397 posts
  • Real Name:Mark
  • Gender:Male

Posted 08 March 2011, 22:29

View PostXpajun, on 08 March 2011, 22:23, said:

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.
My Contributions (so far):

Join Us On Facebook & Twitter Infobox

Contributions currently installed into osCommerce 2.3.1

  • Ajax Attributes Manager
  • CKEditor
  • Column Listing with smart column (modified)
  • Documents Manager
  • Easy Map
  • EasyPopulate v2_76i_231
  • Mindsparx Specials
  • Mindsparx Admin
  • OTF Auto Thumbnailer v2.4
  • Star Product v1.6 + Mindsparx Pimped version
  • Ultimate SEO Urls
  • Who's Online Enhancement
  • Printer Filter V1.7 (modified)
  • Info Pages Unlimited v2.07
  • Google Feeder V2.6
  • Year Make Model

#8 Xpajun

  • Community Member
  • 1,272 posts
  • Real Name:Julian
  • Gender:Male
  • Location:UK

Posted 08 March 2011, 22:36

View PostPupStar, on 08 March 2011, 22:29, said:

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...

#9 PupStar

  • Community Member
  • 397 posts
  • Real Name:Mark
  • Gender:Male

Posted 08 March 2011, 22:47

View PostXpajun, on 08 March 2011, 22:36, said:

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 . '&nbsp;' . 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">&nbsp;</span>
 </div>
</div>
<?php } ?>

My Contributions (so far):

Join Us On Facebook & Twitter Infobox

Contributions currently installed into osCommerce 2.3.1

  • Ajax Attributes Manager
  • CKEditor
  • Column Listing with smart column (modified)
  • Documents Manager
  • Easy Map
  • EasyPopulate v2_76i_231
  • Mindsparx Specials
  • Mindsparx Admin
  • OTF Auto Thumbnailer v2.4
  • Star Product v1.6 + Mindsparx Pimped version
  • Ultimate SEO Urls
  • Who's Online Enhancement
  • Printer Filter V1.7 (modified)
  • Info Pages Unlimited v2.07
  • Google Feeder V2.6
  • Year Make Model

#10 PupStar

  • Community Member
  • 397 posts
  • Real Name:Mark
  • Gender:Male

Posted 11 March 2011, 20:00

Still not managed this, any suggestions welcomed please Julian.

Thanks

Mark
My Contributions (so far):

Join Us On Facebook & Twitter Infobox

Contributions currently installed into osCommerce 2.3.1

  • Ajax Attributes Manager
  • CKEditor
  • Column Listing with smart column (modified)
  • Documents Manager
  • Easy Map
  • EasyPopulate v2_76i_231
  • Mindsparx Specials
  • Mindsparx Admin
  • OTF Auto Thumbnailer v2.4
  • Star Product v1.6 + Mindsparx Pimped version
  • Ultimate SEO Urls
  • Who's Online Enhancement
  • Printer Filter V1.7 (modified)
  • Info Pages Unlimited v2.07
  • Google Feeder V2.6
  • Year Make Model

#11 detoner

  • Community Member
  • 33 posts
  • Real Name:Dawn Toner

Posted 21 July 2011, 13:16

View PostPupStar, on 06 March 2011, 20:40, said:

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.' ' ;

#12 detoner

  • Community Member
  • 33 posts
  • Real Name:Dawn Toner

Posted 21 August 2011, 13:30

View PostPupStar, on 08 March 2011, 22:47, said:

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 . '&nbsp;' . 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">&nbsp;</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>

#13 detoner

  • Community Member
  • 33 posts
  • Real Name:Dawn Toner

Posted 24 August 2011, 08:46

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