Jump to content

protechtrader

Members
  • Posts

    41
  • Joined

  • Last visited

1 Follower

Profile Information

  • Activity
    Prospect

protechtrader's Achievements

Newbie

Newbie (1/14)

2

Reputation

  1. Thanks for the reply, I appreciate the response to talk this out. I was thinking I was replacing that function with the override code, but I may have been mistaken there. So assuming the code is executed twice, which in this example with no change it wouldn't make much sense to do so, but I was still thinking their would be no change in the result. Obviously I am wrong, but what makes this code running twice change the resulting prestashop output? The specific issue I have resulting from this test override only is with the product customization file upload. When you attempt to use the file upload field on any product with any picture valid picture file after clicking the save button a error is given stating it was a unrecognized file format. If you disable the test override the file upload with the same file completes normally. I'm trying to understand what caused that result. Thanks again.
  2. Bump... can anyone let me know if I have a syntax error in my override or something? Like I said the code is just a copy past of default Prestashop 1.6.1.5 init function
  3. Hello, I use a custom ProductController Override, and it is working, as in I know to delete class index and update and code does execute, but I am experiencing some errors when using it. So for troubleshooting I cut out my code changes and just left the Override file with a copy and paste of the initContent() function from my original ProductController.php from PS 1.6.1.5 and I still have the same issue, so I have to assume I am doing something wrong. My testing override file is below. Is their a reason why having this override active would cause anything to change in Prestashop? I guess I am just doing something wrong with how I made this, so If anyone can tell me I appreciate it. /public_html/override/controllers/front/ProductController.php <?php class ProductController extends ProductControllerCore { public function initContent() { parent::initContent(); if (!$this->errors) { if (Pack::isPack((int)$this->product->id) && !Pack::isInStock((int)$this->product->id)) { $this->product->quantity = 0; } $this->product->description = $this->transformDescriptionWithImg($this->product->description); // Assign to the template the id of the virtual product. "0" if the product is not downloadable. $this->context->smarty->assign('virtual', ProductDownload::getIdFromIdProduct((int)$this->product->id)); $this->context->smarty->assign('customizationFormTarget', Tools::safeOutput(urldecode($_SERVER['REQUEST_URI']))); 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->textRecord(); $this->formTargetFormat(); } elseif (Tools::getIsset('deletePicture') && !$this->context->cart->deleteCustomizationToProduct($this->product->id, Tools::getValue('deletePicture'))) { $this->errors[] = Tools::displayError('An error occurred while deleting the selected picture.'); } $pictures = array(); $text_fields = array(); if ($this->product->customizable) { $files = $this->context->cart->getProductCustomization($this->product->id, Product::CUSTOMIZE_FILE, true); foreach ($files as $file) { $pictures['pictures_'.$this->product->id.'_'.$file['index']] = $file['value']; } $texts = $this->context->cart->getProductCustomization($this->product->id, Product::CUSTOMIZE_TEXTFIELD, true); foreach ($texts as $text_field) { $text_fields['textFields_'.$this->product->id.'_'.$text_field['index']] = str_replace('<br />', "\n", $text_field['value']); } } $this->context->smarty->assign(array( 'pictures' => $pictures, 'textFields' => $text_fields)); $this->product->customization_required = false; $customization_fields = $this->product->customizable ? $this->product->getCustomizationFields($this->context->language->id) : false; if (is_array($customization_fields)) { foreach ($customization_fields as $customization_field) { if ($this->product->customization_required = $customization_field['required']) { break; } } } // Assign template vars related to the category + execute hooks related to the category $this->assignCategory(); // Assign template vars related to the price and tax $this->assignPriceAndTax(); // Assign template vars related to the images $this->assignImages(); // Assign attribute groups to the template $this->assignAttributesGroups(); // Assign attributes combinations to the template $this->assignAttributesCombinations(); // Pack management $pack_items = Pack::isPack($this->product->id) ? Pack::getItemTable($this->product->id, $this->context->language->id, true) : array(); $this->context->smarty->assign('packItems', $pack_items); $this->context->smarty->assign('packs', Pack::getPacksTable($this->product->id, $this->context->language->id, true, 1)); if (isset($this->category->id) && $this->category->id) { $return_link = Tools::safeOutput($this->context->link->getCategoryLink($this->category)); } else { $return_link = 'javascript: history.back();'; } $accessories = $this->product->getAccessories($this->context->language->id); if ($this->product->cache_is_pack || count($accessories)) { $this->context->controller->addCSS(_THEME_CSS_DIR_.'product_list.css'); } if ($this->product->customizable) { $customization_datas = $this->context->cart->getProductCustomization($this->product->id, null, true); } $this->context->smarty->assign(array( 'stock_management' => Configuration::get('PS_STOCK_MANAGEMENT'), 'customizationFields' => $customization_fields, 'id_customization' => empty($customization_datas) ? null : $customization_datas[0]['id_customization'], 'accessories' => $accessories, 'return_link' => $return_link, 'product' => $this->product, 'product_manufacturer' => new Manufacturer((int)$this->product->id_manufacturer, $this->context->language->id), 'token' => Tools::getToken(false), 'features' => $this->product->getFrontFeatures($this->context->language->id), 'attachments' => (($this->product->cache_has_attachments) ? $this->product->getAttachments($this->context->language->id) : array()), 'allow_oosp' => $this->product->isAvailableWhenOutOfStock((int)$this->product->out_of_stock), 'last_qties' => (int)Configuration::get('PS_LAST_QTIES'), 'HOOK_EXTRA_LEFT' => Hook::exec('displayLeftColumnProduct'), 'HOOK_EXTRA_RIGHT' => Hook::exec('displayRightColumnProduct'), 'HOOK_PRODUCT_OOS' => Hook::exec('actionProductOutOfStock', array('product' => $this->product)), 'HOOK_PRODUCT_ACTIONS' => Hook::exec('displayProductButtons', array('product' => $this->product)), 'HOOK_PRODUCT_TAB' => Hook::exec('displayProductTab', array('product' => $this->product)), 'HOOK_PRODUCT_TAB_CONTENT' => Hook::exec('displayProductTabContent', array('product' => $this->product)), 'HOOK_PRODUCT_CONTENT' => Hook::exec('displayProductContent', array('product' => $this->product)), 'display_qties' => (int)Configuration::get('PS_DISPLAY_QTIES'), 'display_ht' => !Tax::excludeTaxeOption(), 'jqZoomEnabled' => Configuration::get('PS_DISPLAY_JQZOOM'), 'ENT_NOQUOTES' => ENT_NOQUOTES, 'outOfStockAllowed' => (int)Configuration::get('PS_ORDER_OUT_OF_STOCK'), 'errors' => $this->errors, 'body_classes' => array( $this->php_self.'-'.$this->product->id, $this->php_self.'-'.$this->product->link_rewrite, 'category-'.(isset($this->category) ? $this->category->id : ''), 'category-'.(isset($this->category) ? $this->category->getFieldByLang('link_rewrite') : '') ), 'display_discount_price' => Configuration::get('PS_DISPLAY_DISCOUNT_PRICE'), )); } $this->setTemplate(_PS_THEME_DIR_.'product.tpl'); } }
  4. I can not get a image to upload via the default Product Customization file field. I have tried to troubleshoot this in all the ways I could think (listed below) but I have not made any progress. The error stays unchanged through all of the things I have tried. Any suggestions are appreciated! Error Displayed on Front End: "Image format not recognized, allowed formats are: .gif, .jpg, .png" Apache Logs and PHP logs show no errors with and without debug enabled No new information with debug enabled Things I have tested that have not had any effect: Disabled all Prestashop caching and CCC, and cleared cache through back office and manually CHMOD 777 Full PS for testing CHOWN All PS to www-data Increased PHP file upload and PS customization upload limits Replaced imagemanager.php class with original from github Tried new DEV imagemanager.php class from github Attempted multiple img types (jpg, png) Attempted with multiple fresh images, and even blank jpg saved from ms paint Verified drive space is available Reloaded apache Tried on multiple products with product customization file field Verified normal image upload for a product main images still functions fine with same files VPS config: Server software version Apache/2.4.20 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/1.0.2h PHP version 7.0.6-13+donate.sury.org~trusty+1 Memory limit 512M Max execution time 259200 PrestaShop version 1.6.1.5 Default Bootstrap minimal modifications PHP Settings: file_uploads On max_file_uploads 100 100 memory_limit 512M 512M upload_max_filesize 100M 100M post_max_size 100M 100M If there's helpful information I did not provide please let me know.
  5. Hello guys, I have been working on making custom modules to convert manual edits to the core so they are done properly on a few sites of mine and I have been able to make my first modules and have them work fine. I have also been able to make overrides to do similar functionality in the past, but I wanted to transfer it properly into module form and I wasn't sure if their is a way. In the past I had used a override for OrderConfirmationController to add a few variables with order and product information to the order-confirmation.tpl and it works fine, but I have been told the proper way was to do this in a module using hooks. Well now I am at the point where I have my module setup using the displayorderconfirmation hook and it is working and firing my test hook code, so my question is now what is the proper way to get the variables from the order being places over to my module for use in my hook code. Do I still have to override OrderConfirmationController to have variables with order info such as total price, products ordered, and customer address, or can my module now use its own controller to do this in some way? I have been reading the PS docs and example modules, and that has got me this far, but not sure what is the proper recommended way to proceed at this point. Appreciate any suggestions, thanks!
  6. I have done many searches and tried some things myself without luck. I have found many people asking similar questions about how to have all orders end at the order-confirmation page weather or not they are logged in or not, but no one has had a answer, so is their any way to make sure no orders go to the order-history page automatically and all end up at order confirmation either by a controller override, a module, or any other possibility? PS 1.6.1.5
  7. ndiaga: I am not sure if your offering to create the module or just stating it is possible? gabdara: Thanks for that, it is helpful, but how would you add a discount to the accessories just if their purchased with a product? So like it shows the 50% discount like in my picture, but only when another product is purchased. That way it is full price if someone tried to buy it solo or later removes the main product from their cart.
  8. Hello, I would like to have a small group or category of accessories show up in the Add to Cart confirmation window that are discounted with any purchase of a main product, which is the whole rest of the store besides the few accessories. I attached a picture of what I want. Is their any way to do this with prestashop or a module I can get to do this? I looked through the store and I can not find anything.
  9. Hello, I have had a error for many months now that I was hoping to fix. In back office modules section it shows counts for "Installed Modules" "Disabled Modules" with a count/number below each. My disabled module count has been off or months, through at least 4 full prestashop upgrades, all being 1.6 and 1.6.1 versions up to 1.6.1.5. Im sure it was caused by a bad practise on my end, probably deleted a unused module folder directly without uninstalling it, or similiar, but regardless I would just like to get the count updated properly as "disabled modules" will show 3, and then when I select disabled modules in the drop down to show them their will only be one to show. So somewhere it is off by 2. I can easily check that database and manually count/correct the modules and values, but knowing their are multiple module related tables I wanted to ask what table I should be looking at, and if I should be looking at module names, and or a active/disables flag in the database table. Thanks for your time.
  10. Hello, I was working with my database on a test server clearing out old stats and analytics from a big prestashop database and I found the next largest database table after the stats was ps_stock_available and since this store did not need stock, and has stock management disabled I was wondering if I could truncate it, Tried it on my test server and found I could not purchase my products with combinations. The second attribute's values were empty on the front end, like they were unavailable. So I just restored the test server 15 minutes and no problem, but I wanted to see if I needed my ps_stock_available table, and I see I must need some of it by my little experiment , so I just wanted to ask if there is any fat i can prune there in a for a store not using stock management? Thanks
  11. Hey all, first I wanted to add that I can also verify the stated CSS bug in this thread while Prestashop is installed in a sub directory as stated. I can also verify this github fix helped alot, as 90% of styles properly returned immediately after completing this (with the CCC smarty cache enabled), but for some reason it did not fix everything. For example in my case the first thing I can notice right away that was not fixed by this was my horizontal menu bar CSS is still missing showing the menu items in plain text on the page and the bar is not existent. I wanted to attempt your modification to the github fix to see if it addressed the rest of the CSS issues I was having with the horizontal bar, but I was not clear on your recommended change. The github fix has linke 597 as: $url = str_replace(_PS_THEME_DIR_, _THEMES_DIR_._THEME_NAME_.'/', $filename); How were you recommending that be changed?
  12. This didnt work for me at all I tried multiple times. I overwrote the module with the version on github @ https://github.com/PrestaShop/gapi and it fixed this error and original problem. Modification was not needed.
  13. Anyone have any thoughts? Module seems to work great with this basic fix, just removing the 8 characters outlined in this post fixed it for me ("true" & " true"), but it left me with this error on the backoffice, it is on the dashboard and everywhere in backoffice.
×
×
  • Create New...