FROM CACHE - en_header

Customers to upload image

isabasu
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).

Replies 2 (2)
Alex-RightGeek
Shopify Partner
21 3 10

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' %}
Jasoliya
Shopify Expert
4532 586 1144

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.
Want to convert visitor to buyers ? try This app.
Email: jasoliyabrijesh123@gmail.com Or WhatsApp Or Skype: jasoliya.brijesh
Want to get Free review and advice for sale on store ?? just text me here