Customers to upload image

New Member
9 0 0

Hey there

I was following this tutorial to add an upload button to a product page. It works great, except that on the cart page the logo doesn't show up, even though I've added the cart customizations to the cart file. Ideally, I'd like to display the uploaded image on the cart page. If this shouldn't be possible, the name of the file would be great as well. At the moment the filename will be transformed to a string such as the one below. 

I assume this has to do with the 

enctype="multipart/form-data"

which I couldn't add to my template file. I didn't find the <form> tag.

Also to mention is that, whenever I create a <form> tag by myself the whole upload process doesn't work (whenever I click on add to cart it doesn't do anything).

0 Likes
Excursionist
13 2 2

The form tag can either be written as <form> or {% form %} in your product-template.liquid.

 

Something like this:

{% form 'product', product, class:form_classes, novalidate: 'novalidate', data-product-form: '' %}

The enctype attribute will then be entered as thus (don't forget the comma and space to separate the previous attributes):

{% form 'product', product, class:form_classes, novalidate: 'novalidate', data-product-form: '', enctype: 'multipart/form-data' %}
I make custom Shopify pages & themes.. rgeekdigital.com | info@rgeekdigital.com
0 Likes
Shopify Expert
2488 417 525

Hi @isabasu 

If you cant do with this, then you have to create image tag on cart page.

Open section->cart-template.liquid and fine property loop.

you can add condition like that:

{% if p.first == 'Photo' %}
   {{ p.first }}:<a href="{{p.last}}" target="_blank"><img style="vertical-align: middle;width: 100px;" id="cart_breed" src="{{p.last}}"></a>
<br/>
{% else %}
Rest existing code
{% endif %}

Note: change p.first == 'Photo' to your property name of image.

Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: jasoliyabrijesh123@gmail.com
Skype: jasoliya.brijesh
Want to get Free review and advice for sale on store ?? just text me here
0 Likes