Forums / General Questions / Insert the product sale price in code

Insert the product sale price in code

Started by pexter on 7 Dec 2018, 8:53 PM · Views: 1,358

Results 1 to 6 of 6
7 Dec 2018, 8:53 PM
#1
pexter avatar

pexter

New Zenner

Join Date:
May 2013
Location:
Karlskoga, Sweden
Posts:
48
Plugin Contributions:
0

Insert the product sale price in code

I've been searching around trying to find a variable for the product special price.
I'm adding optional financing to my products and I need to feed the script with the price.

Here is part of the code:

<div class="CIT-widget cit-widget-inline-button" cit-data-type="outlined" cit-data-amount="5000">

It's the 5000 that needs to be replaced with a variable string for my sales special price. Ideal would be a function that inserts what ever price is the lowest (base, special or salemaker price).

Does anyone know the name of the variable for the special price?

Thanks!

7 Dec 2018, 9:10 PM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Insert the product sale price in code

Are you wanting: zen_get_products_display_price($products_id)?

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

7 Dec 2018, 9:19 PM
#3
pexter avatar

pexter

New Zenner

Join Date:
May 2013
Location:
Karlskoga, Sweden
Posts:
48
Plugin Contributions:
0

Re: Insert the product sale price in code

mc12345678:

Are you wanting: zen_get_products_display_price($products_id)?

Yes! That's probably the right one, what's the correct syntax in the code? (I need to add it as html in the product description field)

7 Dec 2018, 9:50 PM
#4
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Insert the product sale price in code

pexter:

Yes! That's probably the right one, what's the correct syntax in the code? (I need to add it as html in the product description field)
Okay, so first, based on your description of what you wanted in the html code, I gave you the wrong function. The function I provided includes other html as an output.

The function that seems to fit your description is: zen_get_products_special_price($product_id, $specials_price_only=false)

Now, the thing is you are saying that you want to execute php code inside of your description... That requires a modification of code to use say swguy's boiler plate code to be able to execute the desired operation.

If you otherwise wanted to have that data say before or after the description then it could be added into the applicable tpl_PRODUCT_TYPE_info.php template file. To get what may be expected to be the "lowest" price, you would use:

<?php echo zen_get_products_special_price((int)$_GET['products_id'], false); ?>

Where you wanted that price to be shown. The function outputs the base price of the product if there is no special or sale, the specials price if there is no sale, or the sale price if there is a sale.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

7 Dec 2018, 10:12 PM
#5
pexter avatar

pexter

New Zenner

Join Date:
May 2013
Location:
Karlskoga, Sweden
Posts:
48
Plugin Contributions:
0

Re: Insert the product sale price in code

I added it to the /templates/tpl_product_info_display.php file and it works like a charm! Thank you so much!

Next thing is to skip the code if product price is below $2000, any ideas? EDIT: Never mind, the finance institute doesn't send anything back if the price is too low! :D

7 Dec 2018, 10:30 PM
#6
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Insert the product sale price in code

pexter:

I added it to the /templates/tpl_product_info_display.php file and it works like a charm! Thank you so much!

Next thing is to skip the code if product price is below $2000, any ideas? EDIT: Never mind, the finance institute doesn't send anything back if the price is too low! :D
Was going to answer with another question of "which price" being less than $2000.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...