I'm working with a function that runs immediately after a user submits an order to his/her Magento shopping cart, and I'm trying to get the URL for the file the user has just uploaded, so that I can manipulate it before the order is officially submitted.
I'm getting the quote data correct, and when I output the object with print_r, I can SEE where the URL is in the object data, but I can't write the code to actually pull that specifically. Here's a snippet of my function:
<?php
class Image_Processor_Model_Observer {
public function autoMetaDescription(Varien_Event_Observer $observer) {
$checkout = Mage::getSingleton('checkout/session')->getQuote();
$options = $checkout->getProductOptions();
$sales_quote = $options->sales_quote;
print "<pre>";
print_r($checkout);
print "</pre>";
die();
}
}
?>
And here's a snippet of the output I'd like to access:
[option_3] => Mage_Sales_Model_Quote_Item_Option Object
(
[_item:protected] => Mage_Sales_Model_Quote_Item Object
*RECURSION*
[_product:protected] => Mage_Catalog_Model_Product Object
*RECURSION*
[_eventPrefix:protected] => core_abstract
[_eventObject:protected] => object
[_resourceName:protected] => sales/quote_item_option
[_resource:protected] =>
[_resourceCollectionName:protected] => sales/quote_item_option_collection
[_cacheTag:protected] =>
[_dataSaveAllowed:protected] => 1
[_isObjectNew:protected] =>
[_data:protected] => Array
(
[product_id] => 3
[product] => Mage_Catalog_Model_Product Object
*RECURSION*
[code] => option_3
[value] => a:9:{s:4:"type";s:24:"application/octet-stream";s:5:"title";s:19:"EatingBreakfast.jpg";s:10:"quote_path";s:68:"\media\custom_options\quote\E\a\9884fbc76ede5ddb9ef991b83c17f8ae.jpg";s:10:"order_path";s:68:"\media\custom_options\order\E\a\9884fbc76ede5ddb9ef991b83c17f8ae.jpg";s:8:"fullpath";s:93:"D:\Our Files\Web\lifewall\media\custom_options\quote\E\a\9884fbc76ede5ddb9ef991b83c17f8ae.jpg";s:4:"size";s:7:"8050795";s:5:"width";i:3000;s:6:"height";i:3997;s:10:"secret_key";s:20:"9884fbc76ede5ddb9ef9";}
[item_id] =>
)
[_hasDataChanges:protected] => 1
[_origData:protected] =>
[_idFieldName:protected] =>
[_isDeleted:protected] =>
[_oldFieldsMap:protected] => Array
(
)
[_syncFieldsMap:protected] => Array
(
)
)
I hope that's all clear. I just need the .jpg path you see in the 'value' part of the output. Any ideas how to pull that? Thanks!
` And I'm not able to output any value from $url or $path, even though the values are in that big print_r() output of $quote. Any other suggestions?
– Alex MacArthur Oct 16 '15 at 02:59$uploadedImageis anything in there? – rob3000 Oct 16 '15 at 03:06print_r($uploadedImage), the number '1' is the only thing that's outputted to the screen. – Alex MacArthur Oct 16 '15 at 03:17print_r($quote->getData()); – rob3000 Oct 16 '15 at 03:41Array ( [store_id] => 1 [is_checkout_cart] => 1 [remote_ip] => 127.0.0.1 [x_forwarded_for] => ) 1Thanks for the continued help, by the way!
– Alex MacArthur Oct 17 '15 at 01:08