sarasallam Posted October 22, 2014 Share Posted October 22, 2014 Hi, I wish you can help me with the customization filed within product, Is there any way we can allow customer to customize product by uploading doc file?Because it only allows pictures , how to add other supported formats. Best regards, Link to comment Share on other sites More sharing options...
Tung at RockPOS.com Posted October 22, 2014 Share Posted October 22, 2014 @sarasallam That's really weird, whey it says "file fields" but only allows pictures. I'm afraid that, you have to do quite much customization here. 1. Add a new type in BO > product page. Look at the code in /admin/themes/default/template/controllers/products/customization.tpl And do the similar thing. For example, you can add the third type: "My fields". 2. Show your custom fields at FE > product page: Refer to the file /themes/default-bootstrap/product.tpl, then look up section "< ! - - Customization - - >" 3. Accept custom fields from your users Open /controllers/front/ProductController.php, and locate to ProductControllerCore::initContent(), this is the right place for you: if (Tools::isSubmit('submitCustomizedDatas')) { // If cart has not been saved, we need to do it so that customization fields can have an id_cart // We check that the cookie exists first to avoid ghost carts if (!$this->context->cart->id && isset($_COOKIE[$this->context->cookie->getName()])) { $this->context->cart->add(); $this->context->cookie->id_cart = (int)$this->context->cart->id; } $this->pictureUpload(); $this->uploadMyFields();// Here you go, of course, create your own function "uploadMyFields" to handle uploading. It should be similiar to $this->pictureUpload(); $this->textRecord(); $this->formTargetFormat(); } 4. If you don't know how to process uploading a file (rather than images), back to BO > Product page > Attachment and study how Prestashop does the same thing. Hope this helps! Link to comment Share on other sites More sharing options...
Recommended Posts