0

we are providing an option for customer to upload an image from frontend here

1.Once customer upload image from product view page and click on "Add to cart",

we are saving custom image in this path : media/custom_options/quote like below :

media/custom_options/quote/2/4/image_name1.png
media/custom_options/quote/6/7/image_name2.png

in DB we are saving image path in table : sales_flat_quote_item_option& in column : value

2.if customer place an order, we are saving custom image in this path : media/custom_options/order

media/custom_options/order/2/4/image_name1.png
media/custom_options/order/6/7/image_name2.png

in DB we are saving image path in table : sales_flat_order_item& in column : product_options

Also we are saving random url in same column :

s:170:"<a href="http://sbdev2.kidsdial.com:81/sales/download/downloadCustomOption/id/7060/key/b0fa267c97fbd0d5ed9e/" 
target="_blank">custom_product_preview.png</a> 300 x 500 px."; 

we are displaying Custom image in order email with help of above url.

Now, we want to save same url once customer upload custom image & click on Add to cart in table : sales_flat_quote_item_option& in column : value , so that we can send custom image in Abandoned cart email

Edit

we are saving like this link in DB, I need add below in DB.

s:170:"<a 

href="http://sbdev2.kidsdial.com:81/sales/download/downloadCustomOption/id/7060/

key/b0fa267c97fbd0d5ed9e/" target="_blank">custom_product_preview.png</a> 300 x 

500 px.";

edit3

we are using below download url code after placing an order, full code : http://pastebin.com/V2zVv0bJ

protected function _getOptionHtml($optionValue)
    {
        if ($this->_isCreateOrderRequest())
        {
            return parent::_getOptionHtml($optionValue);
        }

        try {
            $option = $this->getOption();
        } catch (Exception $e) {
            $option = $this->_getOptionByValue($optionValue);
        }

        $value = $this->_getValueOption($optionValue);

        $isTempData = false;
        $data = array();
        if( Mage::helper('aitcg/options')->checkAitOption( $option ) &&  $option->getData("image_template_id") > 0)
        {

            $model = Mage::getModel('aitcg/image');

            $data = $this->_getImageData($model, $value);
            $data = $this->_getAreaData($option, $model, $data);

            $isTempData = true;

        }
        return $this->_sprintOption($value, $optionValue, $option, $data, $isTempData);
    }

    protected function _sprintOption($value, $optionValue, $option, $data, $isTempData)
        {

            $js = "";
            if($isTempData)
            {
                $sBlockName = $this->_getBlockName();
                $js =  Mage::app()->getLayout()
                    ->createBlock($sBlockName, null, $data)
                    ->setProduct( $option->getProduct() )
                    ->setOption( $option )
                    ->toHtml();

                return $js;
            }
            else
            {
                return $js . sprintf('<a href="%s" target="_blank">%s</a> %s',
                    $this->_getOptionDownloadUrl($value['url']['route'], $value['url']['params']),
                    Mage::helper('core')->htmlEscape($value['title']),
                    $this->_getSizes($optionValue)
                );
            }

we are using above code to get image download url in DB, but its not saving that url in DB. full file : http://pastebin.com/MLPxi4E0

  • As you mention in step 1 it is already get save in sales_flat_quote_item_option – Gopal Patel Feb 28 '17 at 7:16
  • @GopalPatel yes, image path are saving in server, but i want to save image download url as link. why i need is i want to send an abandoned cart email to customer , so that i need to save image download url once customer click on add to cart..... – Baby in Magento Feb 28 '17 at 7:20
  • if i save image download url , than i can send same url in email, so that customer can see custom image in abandoned cart email similar to order confirmation email..... – Baby in Magento Feb 28 '17 at 7:28
  • is that path is getting save in sales_flat_quote_item_option ?? – Gopal Patel Feb 28 '17 at 7:30
  • @GopalPatel yes , in table sales_flat_quote_item_option & in column value , image paths are saving.... ` please check complete value : pastebin.com/Jmfd4J4P – Baby in Magento Feb 28 '17 at 7:34
1

After Add to cart you are gettng

a:11:
{
    s:4:"type";
    s:9:"image/png";
    s:5:"title";
    s:26:"custom_product_preview.png";
    s:10:"quote_path";s:68:"/media/custom_options/quote/1/7/b0fa267c97fbd0d5ed9e4732d6fdc3da.png";
    s:10:"order_path";s:68:"/media/custom_options/order/1/7/b0fa267c97fbd0d5ed9e4732d6fdc3da.png";
    s:8:"fullpath";s:88:"/var/www/html/sbdev2/media/custom_options/quote/1/7/b0fa267c97fbd0d5ed9e4732d6fdc3da.png";
    s:4:"size";i:78561;
    s:5:"width";i:300;
    s:6:"height";i:500;
    s:10:"secret_key";
    s:20:"b0fa267c97fbd0d5ed9e";
    s:10:"aitcg_data";
    a:2:
    {
        s:11:"template_id";
        s:3:"204";
        s:16:"metadata_version";
        s:3:"1.0";
    }
    s:3:"url"; //Download Url
    a:2:
    {
        s:5:"route";
        s:35:"sales/download/downloadCustomOption"; // module/controller/action
        s:6:"params";
        a:2:
        {
            s:2:"id";
            s:4:"7060";
            s:3:"key";
            s:20:"b0fa267c97fbd0d5ed9e";
        }
    }
}

From this you can generate your Download URL

Not sure how you print above (May be from quote or any object)

So your download url will be

http://sbdev2.kidsdial.com:81/(YOUR_DOMAIN)sales/download/downloadCustomOption/(module/controller/action)id/7060/key/b0fa267c97fbd0d5ed9e(PARAMETERS)

| improve this answer | |
  • please update an answer with code..... – Baby in Magento Feb 28 '17 at 9:12
  • How you print that file?? from items option of quote object?? @BabyinMagento – Gopal Patel Feb 28 '17 at 9:15
  • please check edit3 part in question.... please let me know if that is not you wanted...... – Baby in Magento Feb 28 '17 at 10:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.