Results 1 to 4 of 4
  1. #1

    Default Can I change all prices by changing function zen_get_products_special_price

    Hello I want to have a 10% discount on featured products but only on CART PAGE so I added on tpl_shopping_cart_default:

    PHP Code:
    <div class="featured-crossale">
                
            
                <?php require($template->get_template_dir('tpl_modules_featured_products2.php',DIR_WS_TEMPLATE$current_page_base,'templates'). '/tpl_modules_featured_products2.php'); ?>
        </div>
    tpl_modules_featured_products2.php is modified acording to use function zen_get_products_special_price2 from function_prices.php where I have copied function zen_get_products_special_price and changed

    PHP Code:
    $special_price $specials->fields['specials_new_products_price']; 
    to

    PHP Code:
     $special_price round(($specials->fields['specials_new_products_price'])*0.900); 

    When I did that the prices on Fetured products located only on the cart page changed with -10% (the way i wanted), but when I press "add to cart" button, cart page reloaded with adding fetured products but on the regular price not the discounted.

    Any sugestions what I'm doing wrong?
    Why i love perfumes is because they smell nice. Why I use zen-cart is because it is the most advanced free and coder friendly system I know that can rank well in google.

  2. #2

    Default Re: Can I change all prices by changing function zen_get_products_special_price

    I figured that i have to look in clases/shoping_cart.php and found:

    PHP Code:
    $special_price zen_get_products_special_price($prid); 
    I changed it to:

    PHP Code:
    if(in_array($current_page_base,explode(",",'shopping_cart'))) {
    $special_price zen_get_products_special_price2($prid);
    }
    else{
    $special_price zen_get_products_special_price($prid);

    This didnt work, but if I only change zen_get_products_special_price($prid) to zen_get_products_special_price2($prid); all of my catalog have -10% when pressing the "ADD TO CART" button. That is why I used if(in_array($current_page_base,explode(",",'shopping_cart'))) but I supose it wont work on clases/shoping_cart.php?

    Any workaround for this?
    Why i love perfumes is because they smell nice. Why I use zen-cart is because it is the most advanced free and coder friendly system I know that can rank well in google.

  3. #3
    Join Date
    Jul 2012
    Posts
    12,884
    Plugin Contributions
    16

    Default Re: Can I change all prices by changing function zen_get_products_special_price

    Price is determined in a number of places and through a variety of processes. By changing just the template, the display of the price has been modified for that page, but not in all locations. For example a featured product that gets displayed as a new product say within a category will not show the reduced price, nor will it display with the reduced price in a listing of similar product to the one purchased, etc...

    So the question becomes, why not just put featured product on special and save from doing additional coding? Otherwise, one way to show a reduced price as desired is that when putting the product together in includes/modules/pages/shopping_cart/header_php.php determine if the product is a featured product and if so to then reduce the price as described. Understand that this price modification would need to occur so as not to cause problems with determining taxes.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...
    Upgraded to Zen Cart V1.5.3 from V1.5.1 from V1.5.0 from V1.3.9h

  4. #4

    Default Re: Can I change all prices by changing function zen_get_products_special_price

    Quote Originally Posted by mc12345678 View Post
    Price is determined in a number of places and through a variety of processes. By changing just the template, the display of the price has been modified for that page, but not in all locations. For example a featured product that gets displayed as a new product say within a category will not show the reduced price, nor will it display with the reduced price in a listing of similar product to the one purchased, etc...

    So the question becomes, why not just put featured product on special and save from doing additional coding? Otherwise, one way to show a reduced price as desired is that when putting the product together in includes/modules/pages/shopping_cart/header_php.php determine if the product is a featured product and if so to then reduce the price as described. Understand that this price modification would need to occur so as not to cause problems with determining taxes.

    The featured are now on special, so I want to add another 10% discount to specials-featured on cart page, ok i will look at header_php.php to see if i can make something.

    Kind regards.
    Why i love perfumes is because they smell nice. Why I use zen-cart is because it is the most advanced free and coder friendly system I know that can rank well in google.

 

 

Similar Threads

  1. v138a Changing all prices to a different currency
    By MeltDown in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 10
    Last Post: 9 May 2012, 12:46 PM
  2. How can I change many attribute prices to all be the same?
    By sofasurfer in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 19 Sep 2011, 08:17 AM
  3. SQL for changing all products' prices?
    By dinki in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 18 Jun 2009, 06:31 PM
  4. Replies: 2
    Last Post: 3 Jun 2009, 09:31 PM
  5. How Can I change All products prices in one time ?
    By darknes in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 2
    Last Post: 29 Nov 2008, 01:59 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR