Custom line item type displays fine and cart totals fine. But Shopping Cart Form has this at the top.

Custom line item type has two price fields.

Why would the base_price not be getting set?

Notice: Undefined index: base_price in theme_commerce_price_rrp_your_price() (line 304 of C:\htdocs\sites\all\modules\commerce_extra_price_formatters\commerce_extra_price_formatters.module).
Notice: Undefined index: base_price in theme_commerce_price_rrp_your_price() (line 305 of C:\htdocs\sites\all\modules\commerce_extra_price_formatters\commerce_extra_price_formatters.module).
Notice: Undefined index: base_price in theme_commerce_price_rrp_your_price() (line 314 of C:\htdocs\sites\all\modules\commerce_extra_price_formatters\commerce_extra_price_formatters.module).

Here are the lines referencing base_price:

$web_price = $variables['components']['commerce_price_rrp_your_price']['formatted_price'];
  $rrp = $variables['components']['base_price']['formatted_price']; // line 304
  $rrp = $variables['components']['base_price']['price']['amount']; // line 305 -- doesn't this overwrite 304??

  if ($variables['options']['include_tax_in_rrp'] == TRUE) {
    foreach($variables['components'] as $component_name => $component_value){
      if (substr($component_name, 0, 3) == 'tax'){
        $rrp += $component_value['price']['amount'];
      }
    }
  }
  $rrp = commerce_currency_format($rrp, $variables['components']['base_price']['price']['currency_code']); // line 314

Comments

derekw’s picture

Issue summary: View changes

Added relevant code lines

ikos’s picture

Hi,

Sorry it's taken so long to get a response to this issue. Been a bit busy here and am just sitting down to review the outstanding issues.

You're right about line 305 overriding 304 -clearly an old bit of code needs taking out.

It's clearly the case here that the base price is not being set in the components array - I wonder if this is related to you having two separate price fields in the same line.

Can you confirm which version of Commerce you are using and if you are still experiencing this as I have not seen it happen before.

many thanks

Richard

ikos’s picture

Status: Active » Postponed (maintainer needs more info)

Hi,

Can you confirm if this is a problem in the latest dev version?

many thanks

Richard

DrupalGideon’s picture

I get this on using Commerce 7.x-1.2 and 7.x-1.0 of this module.

I currently don't have any rules set up to apply discounts on any products.

My RRP is showing as £0.00 whilst my offer price is showing the correct price I have entered.

I do have the Price Table module also installed - could that be causing a problem?

farald’s picture

I do not have the price table installed, issue confirmed on 1.0.

iaminawe’s picture

I am also receiving this

farald’s picture

The first $rrp is indeed overwritten.
But there's also another funky issue. Xdebug reports there are no $variables['components']['base_price'] defined. Instead we only have commerce_price_rrp_your_price

This only happens when there are no tax configured for the product. Then there are no base_price, resulting in these errors.

ikos’s picture

I still haven't been able to reproduce this. Is anyone else able to reproduce using Kickstart and the latest dev and maybe upload a db dump?

many thanks

Richard

derekw’s picture

I'm sorry can't comment as I've switched to using the Formatted Components formatter.

Jones03’s picture

Status: Postponed (maintainer needs more info) » Active

It seems this is issue is caused by using the formatter on a self created node price field, while it can only be used on one field: the commerce_price. So a solution is to only use the extra formatter on the commerce price, and always use this field to display your price.

It would be great to have it available for other fields too though.

dimitriseng’s picture

I had the same issue using the latest dev.

ikos’s picture

Status: Active » Postponed (maintainer needs more info)

I am still unable to reproduce this. Can anyone explain to me a scenario where you would use a price formatter on a secondary price field?
I expect there is one - but I am struggling to understand when price components would be set for a secondary price field.

many thanks

Richard

vishy_singhal’s picture

You could add in a secondary price when you want the users to add their commission along with their base price.

That is where it is causing error.

harings_rob’s picture

I'm having this issue to.

I use it in this way: Buyin price for admin reference (calculation of profit).

When viewing a product the following error message appears:

Notice: Undefined index: base_price in theme_commerce_price_rrp_your_price() (regel 410 van /profiles/commerce_kickstart/modules/contrib/commerce_extra_price_formatters/commerce_extra_price_formatters.module).
Notice: Undefined index: base_price in theme_commerce_price_rrp_your_price() (regel 426 van /profiles/commerce_kickstart/modules/contrib/commerce_extra_price_formatters/commerce_extra_price_formatters.module).
robit8deb’s picture

started having this issue after updating to kickstart 2.8.

jjmackow’s picture

I'm seeing it also; full issue comes as:
Notice: Undefined index: base_price in theme_commerce_price_rrp_your_price() (line 410 of /sites/all/modules/commerce_extra_price_formatters/commerce_extra_price_formatters.module).
Notice: Undefined index: base_price in theme_commerce_price_rrp_your_price() (line 426 of /sites/all/modules/commerce_extra_price_formatters/commerce_extra_price_formatters.module).

derMatze’s picture

Same problem here.
Any idea?

HJulien’s picture

I was getting this error after I added a MSRP (Manufacturer Suggested Retail Price) field to the variation types. I removed the field and the problem went away..... Don't know what this is all about but maybe it'll help someone get past the problem.

HJulien’s picture

Issue summary: View changes

Added detail two price fields

mikeaja’s picture

@ikos #11

Re. "Can anyone explain to me a scenario where you would use a price formatter on a secondary price field?"

Surprised at this question coming from the creator of this awesome module.

Quick list although I'm sure there are many more:

  1. Price with tax and price without
  2. Price per individual unit and total price
  3. Price with / without tax and separate tax amount

Worth also noting that some of the above are necessary in some countries when selling certain products.

harings_rob’s picture

I'm also having these errors.

Using commerce kickstart + vat module.

twist197’s picture

This error appears when using custom displays. For me error left when I switched to Teaser or Full Node displays

kingandy’s picture

We were experiencing this error until just now, when it occurred to me to look at the Display options for our product type (Admin > Store > Product Types > [product type] > Manage Display). It looks like custom price fields automatically select "RRP / Your Price" by default - probably because there's no default formatter and "RRP / Your Price" is at the top of the list, so as soon as you edit the display options and don't specifically select a more sane formatter, it'll save with "RRP / Your Price".

I'd say it's not unreasonable to assume that the settings are correct when you've never edited the Display options before, or at least that by saving an unchanged form you won't cause new problem.

To resolve this I'd say a more sensible formatter needs to be placed at the top of the list and/or selected by default, or the "RRP / Your Price" should not display for fields that won't come with a Base Price component. (TBH I'm not paticularly clear how you'd even add an RRP element to the default price field, so I'm not sure when this would be appropriate.)

Chalk’s picture

Seems that RRP format works only with field 'commerce_price'. If you try to use RRP format with your custom field (type - price) - the error occurs.