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
Comment #0.0
derekw CreditAttribution: derekw commentedAdded relevant code lines
Comment #1
ikos CreditAttribution: ikos commentedHi,
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
Comment #2
ikos CreditAttribution: ikos commentedHi,
Can you confirm if this is a problem in the latest dev version?
many thanks
Richard
Comment #3
DrupalGideonI 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?
Comment #4
farald CreditAttribution: farald commentedI do not have the price table installed, issue confirmed on 1.0.
Comment #5
iaminawe CreditAttribution: iaminawe commentedI am also receiving this
Comment #6
farald CreditAttribution: farald commentedThe 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 havecommerce_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.
Comment #7
ikos CreditAttribution: ikos commentedI 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
Comment #8
derekw CreditAttribution: derekw commentedI'm sorry can't comment as I've switched to using the Formatted Components formatter.
Comment #9
Jones03 CreditAttribution: Jones03 commentedIt 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.
Comment #10
dimitriseng CreditAttribution: dimitriseng commentedI had the same issue using the latest dev.
Comment #11
ikos CreditAttribution: ikos commentedI 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
Comment #12
vishy_singhal CreditAttribution: vishy_singhal commentedYou 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.
Comment #13
harings_rob CreditAttribution: harings_rob commentedI'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:
Comment #14
robit8deb CreditAttribution: robit8deb commentedstarted having this issue after updating to kickstart 2.8.
Comment #15
jjmackow CreditAttribution: jjmackow commentedI'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).
Comment #16
derMatze CreditAttribution: derMatze commentedSame problem here.
Any idea?
Comment #17
HJulien CreditAttribution: HJulien commentedI 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.
Comment #17.0
HJulien CreditAttribution: HJulien commentedAdded detail two price fields
Comment #18
mikeaja CreditAttribution: mikeaja commented@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:
Worth also noting that some of the above are necessary in some countries when selling certain products.
Comment #19
harings_rob CreditAttribution: harings_rob commentedI'm also having these errors.
Using commerce kickstart + vat module.
Comment #20
twist197 CreditAttribution: twist197 commentedThis error appears when using custom displays. For me error left when I switched to Teaser or Full Node displays
Comment #21
kingandy CreditAttribution: kingandy commentedWe 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.)
Comment #22
Chalk CreditAttribution: Chalk commentedSeems 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.