...

View Full Version : PHP Notice: Undefined property:



dorys
05-20-2011, 09:47 PM
Sorry if this has been covered a million times and for being a total PHP n00b, but I'm not sure how to fix this issue.

I get a

PHP Notice: Undefined property: JAdministrator::$_SHIPPING in /Applications/MAMP/htdocs/bodylace/administrator/components/com_virtuemart/classes/ps_checkout.php on line 2100

The code is


// Shipping Details
if( is_object($this->_SHIPPING) ) {
$shopper_message .= "\n\n------------------------------------------------------------------------\n";
$shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_SHIPPING_LBL',false).":\n";
$shopper_message .= $shipping_arr[1]." (".$shipping_arr[2].")";
}


I'm also getting the error message on another bit of code farther down the page

if( is_object($this->_SHIPPING) ) {
$shipping_info_details = stripslashes($shipping_arr[1])." (".stripslashes($shipping_arr[2]).")";
}
else {
$shipping_info_details = ' ./. ';
}

I have read that I need to define the property which I assume is $_SHIPPING, however, I also see this in the beginning of the file


class vm_ps_checkout {
var $_SHIPPING = null;
var $_subtotal = null;
var $_shipping = null;
var $_shipping_tax = null;
var $_payment_discount = null;
var $_coupon_discount = null;
var $_order_total = null;
/** @var string An md5 hash of print_r( $cart, true ) to check wether the checkout values have to be renewed */
var $_cartHash;
How do I fix this error?

Fou-Lu
05-21-2011, 12:40 AM
PHP Notice: Undefined property: JAdministrator::$_SHIPPING in /Applications/MAMP/htdocs/bodylace/administrator/components/com_virtuemart/classes/ps_checkout.php on line 2100


These classes do not match: vm_ps_checkout.
The error states the scope in which you are accessing _SHIPPING is that of JAdministrator, but that member if defined in vm_ps_checkout. That indicates that the access to $this->_SHIPPING should probably be accessing a different member's _SHIPPING (ie: $this->my_ps_checkout_var->_SHIPPING) instead.

dorys
05-23-2011, 07:22 PM
These classes do not match: vm_ps_checkout.
The error states the scope in which you are accessing _SHIPPING is that of JAdministrator, but that member if defined in vm_ps_checkout. That indicates that the access to $this->_SHIPPING should probably be accessing a different member's _SHIPPING (ie: $this->my_ps_checkout_var->_SHIPPING) instead.

Thank you. If I understand correctly should I be adding my_ps_checkout_var-> into line 2100?

If so, I tried that and received another undefined property error, plus "Trying to get property of non-object" warning.

Fou-Lu
05-23-2011, 07:30 PM
Thank you. If I understand correctly should I be adding my_ps_checkout_var-> into line 2100?

If so, I tried that and received another undefined property error, plus "Trying to get property of non-object" warning.

No, what I'm saying is that the scope where you are calling _SHIPPING is invalid. Class JAdministrator does not contain a member of that name (although PHP will allow you to construct members at runtime, which is honestly the single stupidest thing I've ever seen zend do), so I presumed that another member within JAdministrator is an object that does. This may or may not actually be the case, as I have no idea if or when the class vm_ps_checkout is added to be accessed by the JAdministrator class.

You need to determine where _SHIPPING is actually supposed to be called, or on what object the _SHIPPING is actually stored within that class. You can view an object's data via var_dump($obj). This will work on $this, and can be used to evaluate the members of the class to determine which if any of them include the _SHIPPING member.

aivanovas
08-03-2011, 06:53 PM
Hi,

Should I include var_dump in the same file where _Shipping code is?
Where and when output of the dumps will go?

Thanks


No, what I'm saying is that the scope where you are calling _SHIPPING is invalid. Class JAdministrator does not contain a member of that name (although PHP will allow you to construct members at runtime, which is honestly the single stupidest thing I've ever seen zend do), so I presumed that another member within JAdministrator is an object that does. This may or may not actually be the case, as I have no idea if or when the class vm_ps_checkout is added to be accessed by the JAdministrator class.

You need to determine where _SHIPPING is actually supposed to be called, or on what object the _SHIPPING is actually stored within that class. You can view an object's data via var_dump($obj). This will work on $this, and can be used to evaluate the members of the class to determine which if any of them include the _SHIPPING member.

aivanovas
08-04-2011, 11:00 AM
Hi,

This problem is related to Virtuemart file ps_checkout and I have made a dump of that file and here is dump output:

[ps_checkout object] Variable Name
Properties
[null] _SHIPPING
[string] _cartHash = "900556ee735af6233f51a3353e77ba0b"
[null] _coupon_discount
[null] _order_total
[null] _payment_discount
[null] _shipping
[null] _shipping_tax
[double] _subtotal = 71.2
Methods
_tax_based_on_vendor_address
add
approx
asterisk_pad
calc_order_shipping
calc_order_shipping_tax
calc_order_subtotal
calc_order_tax
calc_order_taxable
calc_order_totals
country_in_eu_common_vat_zone
display_address
email_receipt
generate_cart_hash
get_checkout_steps
get_current_stage
get_new_cart_hash
get_order_number
get_order_subtotal
get_order_total
get_payment_discount
get_vendor_currency
list_addresses
list_payment_methods
list_shipping_methods
noShipToNecessary
noShippingMethodNecessary
noShippingNecessary
process
ship_to_addresses_radio
show_checkout_bar
show_tax_details
tax_based_on_vendor_address
update
validate_add
validate_form
validate_payment_method
validate_shipping_method
validate_shipto
vm_ps_checkout



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum