Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1
    Join Date
    Oct 2007
    Posts
    105
    Plugin Contributions
    0

    Default Help with Pricing Display

    Morning~

    I think that I know what I need to do but I need a little help getting it done. Here is what I have...

    There are 10,000+ products. 90% of them have 0.00 as the price, for those products, I have been trying to us the "Buy it now" function-changing it to say "Quote" which allows the customer to add it to the shopping cart and checkout so that I can get back to them with a quote. (That's why I'm not using Call for price" ) The other 10% of the products have a real price so I need them displayed as usual and checkout as usual.

    There are no attributes to be concerned with.

    I've been trying to edit the tpl_product_info_display.php but everything I do breaks it. I know it needs an if statement but I'm not sure how to write it and I'm not sure if any other files will need to be changed- probably the shopping cart template too??

    Any assistance would be greatly appreciated. I've been trying to wrap my head around this and I'm just having issues.

    Of course I could be completely wrong about how to tackle this so any other approaches are welcome too!

    Thanks
    Nancy

  2. #2
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: Help with Pricing Display

    Is what you are saying that you want to change the way the button looks dependent on whether the price is $0 or not?

    If so you are in the right place with tpl_product_info_display. Personally, I would build two versions of the $button. Your if statement will look something like:

    Code:
    <?php 
    $ddd = zen_get_products_display_price((int)$_GET['products_id']);//gets the display price
    $ddd = substr($ddd,1);//strips off the $ sign
    $ddd = str_replace(",","",$ddd);//removes the commas that are used to separate thousands for weird American reasons
    if ($ddd = 0){
    //build one button
    }else{
    //build the other button
    }?>
    Exactly where you put this depends on exactly what you are trying to do and what options you are using but it looks like you want to wrap it around the line (as ' build the other button'):
    Code:
                  $the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
    Then repeat it but with a different image specified etc. for the 'quote' button. ie in place of 'build one button'

    As I write this I realise it is not the clearest explanation I have ever created So get back in touch if I have confused you.

  3. #3
    Join Date
    Oct 2007
    Posts
    105
    Plugin Contributions
    0

    Default Re: Help with Pricing Display

    Quote Originally Posted by niccol View Post
    Is what you are saying that you want to change the way the button looks dependent on whether the price is $0 or not?

    If so you are in the right place with tpl_product_info_display. Personally, I would build two versions of the $button. Your if statement will look something like:

    Code:
    <?php 
    $ddd = zen_get_products_display_price((int)$_GET['products_id']);//gets the display price
    $ddd = substr($ddd,1);//strips off the $ sign
    $ddd = str_replace(",","",$ddd);//removes the commas that are used to separate thousands for weird American reasons
    if ($ddd = 0){
    //build one button
    }else{
    //build the other button
    }?>
    Exactly where you put this depends on exactly what you are trying to do and what options you are using but it looks like you want to wrap it around the line (as ' build the other button'):
    Code:
                  $the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
    Then repeat it but with a different image specified etc. for the 'quote' button. ie in place of 'build one button'

    As I write this I realise it is not the clearest explanation I have ever created So get back in touch if I have confused you.
    First of all- Thanks for taking a look~ I'm really boggled by this.

    Here is what I have- I tried what you said and then put in what I thought were the proper buttons- of course, it doesn't work, I'm sure it's the "building the buttons" part that I've messed up- it makes the product info page blank but I changed the whole price block on the tpl_product_info to this:
    Code:
    <!--bof Product Price block -->
    <h2 id="productPrices" class="productGeneral">
    <?php 
    $ddd = zen_get_products_display_price((int)$_GET['products_id']);//gets the display price
    $ddd = substr($ddd,1);//strips off the $ sign
    $ddd = str_replace(",","",$ddd);//removes the commas that are used to separate thousands for American reasons
    if ($ddd = 0){
    //build one button
    $the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
    }else{
    //build the other button
    $the_button = PRODUCTS_ORDER_QTY_TEXT . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '" maxlength="6" size="4" /><br />' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . '<br />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
                }
        $display_button = zen_get_buy_now_button($_GET['products_id'], $the_button);
    }
    ?>
    </h2>
    <!--eof Product Price block -->
    What I'm trying to do is if the price is 0 then have the buy it now button- which I have already changed to a "quote" button. If the price is >0 than put the price there- linked to add to cart.

    I have a feeling that is not what I have accomplished with my above mess. Of course, I'm going to have to do this for each place the price would show up.

    Thanks for your help!
    Nancy

    Nancy

  4. #4
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: Help with Pricing Display

    OK. Well, I need a bit of clarification about what we are trying to do!

    On the product info page there is:
    • A price usually just below the name of the product
    • An 'add to cart' box which contains the quantity (if you are using this) box and an 'add to cart' button


    We have two cases - either the product has a price or not.

    What do you want the price to look like for the two cases?

    What do you want the add to cart box to look like for the two cases?

  5. #5
    Join Date
    Oct 2007
    Posts
    105
    Plugin Contributions
    0

    Default Re: Help with Pricing Display

    This really won't answer your questions from your last post but I'm on to something...

    In modules/product_listing.php (of course I'll use my override when I get this right)

    I put this:
    Code:
     // more info in place of buy now
         $lc_button = '';
                if (zen_has_product_attributes($listing->fields['products_id']) or PRODUCT_LIST_PRICE_BUY_NOW == '0') {
                  $lc_button = '<a href="' . zen_href_link(zen_get_info_page($listing->fields['products_id']), 'products_id=' . $listing->fields['products_id']) . '">' . MORE_INFO_TEXT . '</a>';
                } else {
                  if (PRODUCT_LISTING_MULTIPLE_ADD_TO_CART != 0) {
                    $how_many++;
                    $lc_button = TEXT_PRODUCT_LISTING_MULTIPLE_ADD_TO_CART . "<input type=\"text\" name=\"products_id[" . $listing->fields['products_id'] . "]\" value=0 size=\"4\">";
                  } else {
    			    if ($listing->fields['products_price'] > 0)
    				{
                    $lc_button = '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_price'] . '</a>&nbsp;';
    				}
    				else
    				{
    				$lc_button = '<a href="' . zen_href_link(FILENAME_PRODUCTS_ALL, zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_all->fields['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_BUY_NOW, BUTTON_BUY_NOW_ALT) . '</a>&nbsp;';
    				}
                  }
                }
    And it works- sort of- the two problems with it are 1- the buy it now button says that the product can't be found- obviously I've got that a bit wrong. And the products that do have a price show the price twice- once linked and the other not- the one that is linked does add the product to the cart.

    If you'd like, I could PM you with a link to the site so you can see what the heck I talking about!!


    I really appreciate you looking at this!
    Nancy

  6. #6
    Join Date
    Oct 2007
    Posts
    105
    Plugin Contributions
    0

    Default Re: Help with Pricing Display

    Well, I figured out the product display issues- I have a Buy It Now button for items that need a quote- renamed to the "quote button" and products that have a price, show the price and a link to the "more info"- works well.

    Now I just have one other little area to deal with - I know what I need to do, I just can't seem to write it properly.

    On the tpl_shopping_cart_default page, I'm trying to write an if statement to show the price if the price is > 0 and just put the word Quote if the first statement is false. Maybe it's just not the right place to put that??

    I really, really need to find a course in php!!

    Nancy

  7. #7
    Join Date
    Oct 2007
    Posts
    105
    Plugin Contributions
    0

    Default Re: Help with Pricing Display

    Quote Originally Posted by ladyink View Post
    Well, I figured out the product display issues- I have a Buy It Now button for items that need a quote- renamed to the "quote button" and products that have a price, show the price and a link to the "more info"- works well.

    Now I just have one other little area to deal with - I know what I need to do, I just can't seem to write it properly.

    On the tpl_shopping_cart_default page, I'm trying to write an if statement to show the price if the price is > 0 and just put the word Quote if the first statement is false. Maybe it's just not the right place to put that??

    I really, really need to find a course in php!!

    Nancy
    So maybe changing the define for $productsPrice in includes/modules/pages/shopping_cart/header_php.php is a better idea.

    Any thoughts?
    Nancy

  8. #8
    Join Date
    Oct 2007
    Posts
    105
    Plugin Contributions
    0

    Default Re: Help with Pricing Display

    Right now I have:

    Code:
    <td class="cartTotalDisplay">
    <?php
    if ($product['productsPrice'] > '0.00')
    				{
     echo $product['productsPrice']; 
    }				
    				else
    				{
    echo TEXT_QUOTE; 
    				}
    ?>
     </td>
    in my tpl_shopping_cart_default.php

    The results are that "quote" (which I defined in my english.php file) shows up for everything. I've tried all sorts of ways to put this statement together and results ranging from code showing on the page to a blank page. At least with this it looks normal- but when a product has a price, I need to show the price.

    I don't even know if I'm heading the right direction~

    Nancy

  9. #9
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: Help with Pricing Display

    Trying to keep up with you...

    I suspect that $product['productsPrice'] is not the numerical value of the price but is a string that contains the dollar sign and any commas that are needed as separators. (It is $1,123.89 not 1123.89)
    Code:
    $x = $product['productsPrice'];
    $x = substr($x,1);
    $x = str_replace(",","",$x);
    Is a little chunk of code that will get rid of the dollar sign and the commas.

  10. #10
    Join Date
    Oct 2007
    Posts
    105
    Plugin Contributions
    0

    Default Re: Help with Pricing Display

    Quote Originally Posted by niccol View Post
    Trying to keep up with you...
    Nick- Sorry about that- I feel like I'm beating my head against a wall! I feel like I'm so close and yet so far! Sometimes, if I post something here, the answer suddenly comes to me- not so much in this case!!

    I just know that I have the wrong arguments for the if/then- at least the first part.

    Anyway, I'm not sure where you mean for me to try that last bit of code??

    Nancy

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Help with Wholesale Pricing
    By dmagic in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 17 Aug 2011, 06:28 AM
  2. Display pricing with 2 and 3 decimals
    By Tim M in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 12 Oct 2010, 10:16 PM
  3. Help!! Need to display attribute for one product using two different pricing options
    By a1000w in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 12 Aug 2009, 06:09 PM
  4. Help with Creating Product Type with certain pricing scenario
    By spoma in forum Setting Up Categories, Products, Attributes
    Replies: 6
    Last Post: 16 Jul 2008, 03:45 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg