Jump to content
thirty bees forum
  • 0

Combinations unit price hidden on Niara theme


Jeffrey de Bruijn

Question

Hi again, I am still learning:

I would like to add a product with combinations to the catalog and I find the pricing settings confusing.

I'm doing this:

1. Create new product
2. In the Prices tab I set Unit price (tax excl.) 0 per g (I assign g to the unit field)
3. Add a combination with Impact on unit price increase of 5
4. Add a combination with Impact on unit price increase of 10

With this setup, the unit price is not displayed in the product page.

I looked at product.tpl and I see this smarty line:

{if !empty($product->unity) && $product->unit_price_ratio > 0.000000}

I am guessing that !empty($product->unity) evaluates to true, because I assigned a unit

$product->unit_price_ratio > 0.000000 evaluates to false because the base ratio remains 0

My understanding, as somebody who is new to thirty bees and does not know anything of smarty, is that the && evaluates to false and it is not re-evaluated when the default combination is automatically selected thus the unit price is never shown. Am I correct in this assumption? Why is the "$product->unit_price_ratio > 0.000000" in the condition?

Am I setting up prices in a way that shouldn't be done? I think thirty bees expects the base price to be set and then combinations used to modify the base price, but calculating prices that way is not very straight-forward.

P.S. Where can I find a list of all thirty bees variables that can be passed to smarty?

EDIT:

I was wrong and I am even more confused: changing 

{if !empty($product->unity) && $product->unit_price_ratio > 0.000000}

to

{if !empty($product->unity)}

Does not make a difference, the unit price is still not displayed when the "base" unit price in the prices tab is set to 0 per g.

The complete if statement in product.tpl is the following:

{if !empty($product->unity) && $product->unit_price_ratio > 0.000000}
  {math equation="pprice / punit_price" pprice=$productPrice  punit_price=$product->unit_price_ratio assign=unit_price}
  <p class="unit-price"><span id="unit_price_display">{convertPrice price=$unit_price}</span> {l s='per'} {$product->unity|escape:'html':'UTF-8'}</p>
  {hook h="displayProductPriceBlock" product=$product type="unit_price"}
{/if}

$productPrice is divided by $product->unit_price_ratio and the result is given to the variable unit_price (where is this declared?) which is displayed in the paragraph tag.

$product->unit_price_ratio must be 0 according to my settings above, but it also should be 5 for the first and default combination. This makes no sense, why would the product price be divided by the unit price? But then what is $product->unit_price_ratio?

What variable am I manipulating in the backoffice when I assign the in the Unit price (tax excl.) setting in the Prices tab?

Edited by Jeffrey de Bruijn
My brain boom
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...