Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

how to add products that can have user specific images? (dymically generated images)
 
frietfriet
Jr. Member
 
Total Posts:  9
Joined:  2009-02-27
 

Hello,

I have an online graphics creation application (let’s call it GCA)
that generates images depending on customer input.
A kind of online image designer.
Now I want to use magento to handle the payment.
What I had in mind is the following:
-the user presses some buttons in the GCA and presses the ‘generate image’ button.
-the GCA generates an image and after finishing shows an ‘order image’ button.

-->now it comes:
-pressing the ‘order’ button should redirect to magento which shows your
shopping cart containing (a thumbmail of) the generated image.

how should i approach this last step?
anybody done anything similar?
I’d prefer to not add a product for every new order.

Friet

 
Magento Community Magento Community
Magento Community
Magento Community
 
frietfriet
Jr. Member
 
Total Posts:  9
Joined:  2009-02-27
 

ok after some research I found some more info:

http://www.magentocommerce.com/wiki/adding_a_product_to_the_cart_via_querystring

I can add a product to the shopping cart with a simple URL:
/path/to/app/checkout/cart/add?product=[id]&qty;=[qty]

This is a good start for my functionality I think.
What I need now is two things:
-how can I specify a custom product option (CPO) in the URL?
eg /path/to/app/checkout/cart/add?product=684&qty;=1&design;=harrydesign
I tried adding a (required) text field as CPO with the title “design”. but the above URL
only gives an error about a required option missing.
-how can I adapt the cart display to show an image depending on the CPO?
do i need to modify the core code or can I override the default cart display behaviour?

 
Magento Community Magento Community
Magento Community
Magento Community
 
frietfriet
Jr. Member
 
Total Posts:  9
Joined:  2009-02-27
 

seems like I’m the only one answering my questions wink
anyway I found out I can change the image by changing the
file:
app/design/frontend/default/default/template/checkout/cart/item/default.phtml f

there I can do a $this->getOptionList()
and look up the option which has a label ‘design’ attached to the product in the cart.
using the option value
$_designvalue = $this->getFormatedOptionValue($_option[’value’])

I can look up my design directory and show the correct image by replacing the
line 30:

<td><img src="<?php echo $this->getProductThumbnail()->resize(75); ?>” alt="<?php echo $this->htmlEscape($this->getProductName()) ?>” width="75" /></td>

instead of using getProductThumbnail() I will create my own function that looks up an image depending on the design directory.
I’ll keep you posted about the results in case anybody else wants to do something similar.

 
Magento Community Magento Community
Magento Community
Magento Community
 
frietfriet
Jr. Member
 
Total Posts:  9
Joined:  2009-02-27
 

I still need to know how I can specify a custom product option in the url
anybody has an idea.
pleeeeaaaase!

 
Magento Community Magento Community
Magento Community
Magento Community
 
frietfriet
Jr. Member
 
Total Posts:  9
Joined:  2009-02-27
 

fixed!

answer is here:
http://www.magentocommerce.com/boards/viewthread/33944/

here is a copy of the solution.
-------------------------------------------------------------
well frietfriet has the answer again wink

by studying the html source of the product page I can see in the form that there is an input
field for every required option. the name of the field is ‘options[2]’ for the option that
I have added (a string).

so I can add a product to the shopping cart with the design name set like this:

http://myshop.com/magento/index.php/checkout/cart/add?product=1&options;[2]=design684&qty;=1

voila!
I didn’t get much help from the board visitors but fortunately I can study the source code of magento
which is the ultimate user guide.
long live opensource!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top