Jump to content

dirtrider118

Members
  • Posts

    17
  • Joined

  • Last visited

Profile Information

  • First Name
    Tom
  • Last Name
    J

Recent Profile Visitors

295 profile views

dirtrider118's Achievements

  1. I'm sure the same logic may work for 1.7 but for my shop on 1.6.1.17 I can confirm the following works. I seen a few other ways but seemed quite complicated and involved modifying core files. Not sure how this works with multi-shops. If you look at the below three tables you can fill out the data via excel and import the csv into phpMyAdmin for your site. ps_attachment - Details on file name and format ps_attachment_lang - Attachment name and description to display on front end ps_product_attachment - Ties the ID of the attachment to the product ID !!!!!!!!!!!!!BACKUP ALL 3 TABLES ABOVE BEFORE IMPORTING!!!!!!!!!!!!! How to import attachments with CSV and assign to product: Place all your files (JPG, ZIP, PDF etc.) into the downloads folder in the main shop directory. In my folder the filenames are encoded without an extension like "be7e7fa051951cf". Fill out the attached template and export each tab as CSV. You may notice previously uploaded files added through the back end will show encoded text values under the column "file" in the phpMyAdmin database. For this just match these values to exactly the same as the filenames you uploaded to the download folder (YOURFILENAME.zip). Make sure to fill out the mime field. If you are unsure about the value needed, upload the file through the backend and then check the phpMyAdmin ps_attachment database for the latest ID. Your mime type value will be in the mime column such as "application/zip". To get the file sizes I used the following: https://discussions.apple.com/thread/2674721 - cd (drag folder into Terminal window, press return). Then: ls -l > ~/Desktop/list.txt BACKUP ALL 3 TABLES ABOVE BEFORE IMPORTING CSV INTO PHPMYADMIN MAKE SURE ALL 3 TABLES HAVE MATCHING IDs FOR EACH ATTACHMENT AND PRODUCT VOLA! Import-Attachment-Template.xlsx
  2. Hello, I'm trying to update existing combinations using CSV import. I load the csv and match all the column names but after import the data is getting inserted into the wrong columns inside the ps_product_attribute database table. I can confirm my CSV structure works fine for adding and updating products. At this point I'm only trying to test import the CSV template using the only the default fields. I should note I have added 6 or so custom fields to the back office for each combination. I can add the custom values for each combination fine into the "ps_product_attribute" table from backoffice > product > combinations. I think because I added these new fields it has messed up the order of the CSV import to the ps_product_attribute database table. For example: when I import the combination CSV, the default UPC value is getting inserted into one of the new fields I created in the ps_product_attribute database table. I added all the new fields to the end of the ps_product_attribute database table so i'm not sure why it would mess up the default CSV import order. If someone could point me in the right direction to the function that handles the import order into the data base that would be great. Let me know if you would like to see any of my code. Prestashop 1.6.1.17
  3. Good work! Thanks alot. Important - If you do not have multistore enabled DO NOT add your new field to product_attribute_shop. Only add the new field to product_attribute table. If you add the field to both tables the product_attribute_shop table takes priority. Once I deleted the new field from the table product_attribute_shop my value showed up into the back office.
  4. This code works in 1.6 - file: product.tpl: replace this {foreach from=$features item=feature} {if isset($feature.value)} <li><b>{$feature.name|escape:'html':'UTF-8'}:</b> {$feature.value|escape:'html':'UTF-8'}</li> {/if} {/foreach} With: {foreach from=$features item=feature} {if isset($feature.value)} {assign var="iconFeat" value="img/icons/{$feature.value}.jpg"} {if file_exists($iconFeat)} <td><img src="http://yourwebsite.com/img/icons/{$feature.value}.jpg"/></td> {else} <li><b>{$feature.name|escape:'html':'UTF-8'}:</b> {$feature.value|escape:'html':'UTF-8'}</li> {/if} {/if} {/foreach} Create a folder called "icons" inside your "img" folder within the root directory (outside the themes folder). Place all your icon images inside the new "icon" folder and make sure the image filename matches exactly the same as the product features value setup in the backend (do not include image extension ".jpg" within the feature value). Also, make sure none of your images or product feature values are the same for other features.
  5. You need to increase the VARCHAR value limit in your database. Inside phpMyAdmin go to table "ps_feature_value_lang". Then go to structure tab and for row "value" change column "type" VARCHAR value to the number of characters you set in the PS file.
  6. Hi onkelbillig, Please replace this script: <SCRIPT> $(function() { $('.ajax_block_product img').mouseenter(function(){ // $(this).fadeOut('fast', function(){ $(this).attr('src', $(this).data('on')); //$(this).fadeIn(); // }); }); $('.ajax_block_product img').mouseleave(function(){ //$(this).fadeOut('fast', function(){ $(this).attr('src', $(this).data('off')); // $(this).fadeIn(); // }); }); }); </SCRIPT> with this: <script> $(document).ready(function(){ $(".ajax_block_product").hover(function(){ var onHover = $(this).find( "img" ).data("on"); $('img', this).attr('src', onHover); },function(){ var offHover = $(this).find( "img" ).data("off"); $('img', this).attr('src', offHover); }); }); </script>
  7. This is how I got it to work in 1.6.1.17. This may not work as there may be more files or changes I made that I can't recall, but I can 100% confirm this is working in my shop. In classes file Link.php override or change function "getImageLink" to: public function getImageLink($name, $ids, $type = null, $idOver = NULL) { $not_default = false; // Check if module is installed, enabled, customer is logged in and watermark logged option is on if (($type != '') && Configuration::get('WATERMARK_LOGGED') && (Module::isInstalled('watermark') && Module::isEnabled('watermark')) && isset(Context::getContext()->customer->id)) { $type .= '-'.Configuration::get('WATERMARK_HASH'); } // legacy mode or default image $theme = ((Shop::isFeatureActive() && file_exists(_PS_PROD_IMG_DIR_.$ids.($type ? '-'.$type : '').'-'.(int)Context::getContext()->shop->id_theme.'.jpg')) ? '-'.Context::getContext()->shop->id_theme : ''); if ((Configuration::get('PS_LEGACY_IMAGES') && (file_exists(_PS_PROD_IMG_DIR_.$ids.($type ? '-'.$type : '').$theme.'.jpg'))) || ($not_default = strpos($ids, 'default') !== false)) { if ($this->allow == 1 && !$not_default) { $uri_path = __PS_BASE_URI__.$ids.($type ? '-'.$type : '').$theme.'/'.$name.'.jpg'; } else { $uri_path = _THEME_PROD_DIR_.$ids.($type ? '-'.$type : '').$theme.'.jpg'; } } else { // if ids if of the form id_product-id_image, we want to extract the id_image part $split_ids = explode('-', $ids); $id_image = (isset($split_ids[1]) ? $split_ids[1] : $split_ids[0]); $theme = ((Shop::isFeatureActive() && file_exists(_PS_PROD_IMG_DIR_.Image::getImgFolderStatic($id_image).$id_image.($type ? '-'.$type : '').'-'.(int)Context::getContext()->shop->id_theme.'.jpg')) ? '-'.Context::getContext()->shop->id_theme : ''); if(isset($idOver)){ $result = Db::getInstance()->ExecuteS('SELECT id_image FROM '._DB_PREFIX_.'image WHERE id_product = '.$idOver.' AND position = 2'); foreach ($result as $row) $id_image_over = $row['id_image']; }else{ $id_image_over = 0; } if($id_image_over != 0){ $id_image = $id_image_over; } if ($this->allow == 1) { $uri_path = __PS_BASE_URI__.$id_image.($type ? '-'.$type : '').$theme.'/'.$name.'.jpg'; } else { $uri_path = _THEME_PROD_DIR_.Image::getImgFolderStatic($id_image).$id_image.($type ? '-'.$type : '').$theme.'.jpg'; } } return $this->protocol_content.Tools::getMediaServer($uri_path).$uri_path; } 1. We added "$idOver = NULL" to the function 2. We also added below between "$theme...." and "if ($this->allow == 1)....." : if(isset($idOver)){ $result = Db::getInstance()->ExecuteS('SELECT id_image FROM '._DB_PREFIX_.'image WHERE id_product = '.$idOver.' AND position = 2'); foreach ($result as $row) $id_image_over = $row['id_image']; }else{ $id_image_over = 0; } if($id_image_over != 0){ $id_image = $id_image_over; } In product-list.tpl find: <img class="replace-2x img-responsive" src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')|escape:'html':'UTF-8'}" alt="{if !empty($product.legend)}{$product.legend|escape:'html':'UTF-8'}{else}{$product.name|escape:'html':'UTF-8'}{/if}" title="{if !empty($product.legend)}{$product.legend|escape:'html':'UTF-8'}{else}{$product.name|escape:'html':'UTF-8'}{/if}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} itemprop="image" /> Replace this whole image tag with: <img class="replace-2x img-responsive" data-on="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default', $product.id_product)}" data-off="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')}" src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} itemprop="image" /> <script> $(function() { $('.ajax_block_product img').mouseenter(function(){ // $(this).fadeOut('fast', function(){ $(this).attr('src', $(this).data('on')); //$(this).fadeIn(); // }); }); $('.ajax_block_product img').mouseleave(function(){ //$(this).fadeOut('fast', function(){ $(this).attr('src', $(this).data('off')); // $(this).fadeIn(); // }); }); }); </script>
  8. Tested in 1.6.1.17 and New Products Module v1.10.1 WILL NOT WORK WHEN CACHE IS ENABLED Create file in directory override/modules/blocknewproducts/blocknewproducts.php and place the code below inside file. <?php class BlockNewProductsOverride extends BlockNewProducts { protected function getNewProducts() { if (!Configuration::get('NEW_PRODUCTS_NBR')) return; $newProducts = false; if (Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) if (isset($this->context->controller->php_self) && $this->context->controller->php_self == 'index') { $newProducts = Product::getNewProducts((int) $this->context->language->id, 0, 100);shuffle($newProducts);array_splice($newProducts, Configuration::get('NEW_PRODUCTS_NBR') ); } else { $newProducts = Product::getNewProducts((int) $this->context->language->id, 0, 100);shuffle($newProducts);array_splice($newProducts, Configuration::get('NEW_PRODUCTS_NBR') ); } if (!$newProducts && Configuration::get('PS_BLOCK_NEWPRODUCTS_DISPLAY')) return; return $newProducts; } }
  9. For 1.6 do the following: Duplicate ContactController.php and rename to ex. NewContactController Change class name from ContactControllerCore to ex. NewContactControllerCore Change the php self variable to ex. newcontact on line 29 Duplicate contact-form.tpl and rename to ex. new-contact-form.tpl Point to your new template file by editing $this->setTemplate(_PS_THEME_DIR_.'contact-form.tpl'); on line 255 Delete class_index.php in cache folder in root directory Login to admin backend and add page to SEO & URLS. Access the page URL by http://example.com/i...ller=newcontact This is how i got a second contact page to display. Adding new form fields and variables is up to you. Cheers!
  10. Figured it out. For anyone wanting two contact forms: Duplicate ContactController.php and rename to ex. NewContactController Change class name from ContactControllerCore to ex. NewContactControllerCore Change the php self variable to ex. newcontact on line 29 Duplicate contact-form.tpl and rename to ex. new-contact-form.tpl Point to your new template file by editing $this->setTemplate(_PS_THEME_DIR_.'contact-form.tpl'); on line 255 Delete class_index.php in cache folder in root directory Login to admin backend and add page to SEO & URLS. Access the page URL by http://example.com/index.php?controller=newcontact This is how i got a second contact page to display. Adding new form fields and variables is up to you. Cheers!
  11. Hello, I'm trying to make two contact forms that require different information from the customer for each one. I have tried duplicating and modifying some values in the following files: ContactController.php Contact.php contact-form.tpl email templates (after i get the template file to display) but I can't get the the duplicate file contact-form2.tpl to display. Can someone help me modify the controller(s) so it points to my contact-form2.tpl? Is there any other files involved? ex. the duplicate url to access contact-form2.tpl would be http://www.example.com/index.php?controller=contact2 Thanks! Prestashop 1.6.1.16
  12. Glad I could help. Shame you couldn't display both name and model. If you haven't made any other changes to your file (AdminController.php) other than this edit try replacing your file with mine (attached). As you can see in the image attached I have it working. AdminController.php
  13. Hi taniacr, Sorry i missed some code. In AdminController.php around line 80 find: /** @var string */ protected $identifier_name = 'name'; and add this right below: protected $identifier_model = 'reference'; Let me know how it goes!
  14. Hello, This is how I got it to work on prestashop 1.6.1.1. Edit file AdminController.php and find below if statement around line 1470. Find: if (Validate::isLoadedObject($obj) && isset($obj->{$this->identifier_name}) && !empty($obj->{$this->identifier_name})) { array_pop($this->toolbar_title); array_pop($this->meta_title); $this->toolbar_title[] = is_array($obj->{$this->identifier_name}) ? $obj->{$this->identifier_name}[$this->context->employee->id_lang] : $obj->{$this->identifier_name}; $this->addMetaTitle($this->toolbar_title[count($this->toolbar_title) - 1]); } break; case 'edit': $obj = $this->loadObject(true); if (Validate::isLoadedObject($obj) && isset($obj->{$this->identifier_name}) && !empty($obj->{$this->identifier_name})) { array_pop($this->toolbar_title); array_pop($this->meta_title); $this->toolbar_title[] = sprintf($this->l('Edit: %s'), (is_array($obj->{$this->identifier_name}) && isset($obj->{$this->identifier_name}[$this->context->employee->id_lang])) ? $obj->{$this->identifier_name}[$this->context->employee->id_lang] : $obj->{$this->identifier_name}); $this->addMetaTitle($this->toolbar_title[count($this->toolbar_title) - 1]); } Replace with: if (Validate::isLoadedObject($obj) && isset($obj->{$this->identifier_name}) && !empty($obj->{$this->identifier_name})) { array_pop($this->toolbar_title); array_pop($this->meta_title); // Get product name $nameArray = (is_array($obj->{$this->identifier_name}) && isset($obj->{$this->identifier_name}[$this->context->employee->id_lang])) ? $obj->{$this->identifier_name}[$this->context->employee->id_lang] : $obj->{$this->identifier_name}; // Get product model $modelArray = (is_array($obj->{$this->identifier_model}) && isset($obj->{$this->identifier_model}[$this->context->employee->id_lang])) ? $obj->{$this->identifier_model}[$this->context->employee->id_lang] : $obj->{$this->identifier_model}; // Strip long product names and add dots $maxLength = 52; if (strlen($nameArray) > $maxLength) { $stringCut = substr($nameArray, 0, $maxLength); $nameArray = substr($stringCut, 0, strrpos($stringCut, ' ')); $nameArray = $nameArray . '...'; } // Title Value $this->toolbar_title[] = sprintf($this->l('Edit: %s'), $nameArray . "\n" . "(" . $modelArray . ")" ); $this->addMetaTitle($this->toolbar_title[count($this->toolbar_title) - 1]); } Hope this helps!
  15. I found the issue in case anyone else has this problem. Turns out it was the blockviewed module that I modified. I had changed the blockviewed.php file to try and get access to the product price variable inside the blockviewed.tpl file. I followed post#3 in the below community post which caused the issue. https://www.prestashop.com/forums/topic/248206-products-price-in-block-viewed/ I ended up using post #4 and it worked perfectly! No more more missing thumbnails on refresh.
×
×
  • Create New...