cancel
Showing results for 
Search instead for 
Did you mean: 

How can I load data from user attribute?

How can I load data from user attribute?

Magento 1.9

 

 

I want to do the following functions.

When customers buy suits, he has to fill in the text box.

After clicking "add to cart" (or "update cart" if any amendment), the filled data will rewrite to the user attributes (already created).

 

When the customer buy suits (or another suite), the product view will load the user attribute to the custom options as default value. 

 I have found some plugins for creating user attributes, but how can I make this function of rewrite user attribute and read back as default value?

 

Thanks a lot!

 

1 REPLY

Re: How can I load data from user attribute?

The best solution would be using cookies since it will not affect your cache/full page cache (if you have it set). So, all you have to do is to:

1. Make an observer on checkout_cart_add_product_complete event to grab that custom attribute value and save it in a cookie with:

 

$cookie = Mage::getSingleton('core/cookie');
$cookie->set('cookiename', 'cookievalue' ,time()+86400,'/');

2. Create javascript file which you'll attach to <catalog_product_view> handle, and which should read that cookie value and put it into an appropriate input field.

 

 

I'm not sure that there is extension available which solves this issue for you, but this is technical approach which can be used by any skilled developer to implement such solution.

 

If this response was helpful to you, consider giving kudos to this post.

If this response solved your problem, click accept as solution to help others solve this

If this response was helpful to you, consider giving kudos to this post.
If this response solved your problem, click accept as solution to help others solve this issue