Jump to content

khejit68

Members
  • Posts

    28
  • Joined

  • Last visited

  • Days Won

    1

khejit68 last won the day on May 5 2018

khejit68 had the most liked content!

Profile Information

  • Location
    Poland
  • Activity
    Freelancer

Recent Profile Visitors

382 profile views

khejit68's Achievements

Newbie

Newbie (1/14)

5

Reputation

4

Community Answers

  1. Looks like yes, this two bits are responsible for image upload and AdminController is able to do whole image upload from this. The other part pointing to tpl directory could be misleading. I made some progress. Here is my function: protected function afterImageUpload() { $id = (int)Tools::getValue($this->identifier); $object = new $this->className($id); $picture = _PS_IMG_DIR_.$this->fieldImageSettings['dir'].'/'.$object->id.'.'.$this->imageType; list($width, $height) = getimagesize($picture); if(!ImageManager::resize($picture, _PS_IMG_DIR_.$this->fieldImageSettings['dir'].'/'.$object->id.'_resized'.'.'.$this->imageType, (int)$width/2, (int)$height/2)) return false; return parent::afterImageUpload(); } I wonder if this could be done via afterAdd($object). @EDIT: Yes, it can. Like this: protected function afterAdd($object) { $picture = _PS_IMG_DIR_.$this->fieldImageSettings['dir'].'/'.$object->id.'.'.$this->imageType; list($width, $height) = getimagesize($picture); if(!ImageManager::resize($picture, _PS_IMG_DIR_.$this->fieldImageSettings['dir'].'/'.$object->id.'_resized'.'.'.$this->imageType, (int)$width/2, (int)$height/2)) return false; return true; } But I have to remember about afterUpdate($object) also: protected function afterUpdate($object) { if($this->afterAdd($object)) return true; } I love this forum. Every time I encounter a hard problem, I write it down here and the next day solution comes to me. I hope this is not spamming and it could be useful for someone with similiar problems. @EDIT2: First solution is better. I experienced some weird behaviour when using afterAdd() and afterUpdate(), for example resizing wrong picture in directory. I'm too lazy to check why and afterImageUpload() is flawless. Thanks khejit68, topic is SOLVED.
  2. Hello, I have a module with file input which takes image and puts it into img/modulename directory and later uses reference to that file to show it on frontend. I want to add image resize to half size of original during upload, but I have very difficult time figuring out this upload works. I found AdminPosslideshowController and I think it's responsible for this. Another thing related could be \views\templates\admin\helpers\uploader\simple.tpl, because main module file mendtions it: $this->admin_tpl_path = _PS_MODULE_DIR_ . $this->name . '/views/templates/admin/'; But I don't see much inside controlles except $this->fieldImageSettings = array( 'name' => 'image', 'dir' => 'blockslideshow' ); $this->imageType = "jpg"; and array( 'type' => 'file', 'label' => $this->l('Image:'), 'name' => 'image', 'desc' => $this->l('Upload a banner from your computer.') ), which is inside RenderForm method of this controller. Is this possible that prestashop makes from this bits a whole picture uploader which knows where to put the file and how to call it? I found this topic on stackoverflow, but I still don't know how to access the uploaded file to manipulate it. Any tips in the right direction are appreciated. I couldn't find any learning sources about this matter. regards Mikołaj posslideshow_controller&admin_tpl.zip
  3. Thanks, I solved my old problem. I removed is_customer_param from order-opc-new-account.tpl, but I added class hidden instead, because I just want to hide the input I don't use. I also removed 'required'=>true from definition in Address class, from both phones, because I don't want this to be obligatory. Before that fix I had whole div containing first phone removed from both occurences in order-opc-new-account.tpl. It was okay, but when customer got to guest checkout, left for some more shopping and came back to guest checkout, there was an error about phone being invalid. Now the error is gone, but field for first phone is invisible anyway I remember the solution consisting of removing unused phone from definition array in Address class, but I wouldn't recommend it. I'm not sure about security of this, and this is core manipulation.
  4. No, this is not correct. I use only one folder for all files of prestashop: in xampp it would be in htdocs folder, lets say /htdocs/presta_folder. Then, multistore feature of prestashop (along with redirects set up in httpd.conf) takes care of handling domains/urls. So I can access localhost/presta_folder, and this would be my first main store, and I can access localhost/my_second_store which is my second store. I don't have folder /htdocs/my_second_store, but this is redirected by httpd.conf to my /htdocs/presta_folder and then multistore feature recognizes this, and builds my second store with multistore feature. I hope I understood your question correctly.
  5. I CAN'T BELIEVE IT I just did it After this topic was posted, I didn't try to do this for a long time, but eventually I needed to do this once more. I followed my previous steps, but @EDIT2 (adding tables with SHOP_DOMAIN to configuration table) wasn't necessary. As far as I know, newer versions of presta store this in separate table, not in ps_configuration. I don't have this entries in ps_configuration and everything works just fine. Important files: a ) .htaccess, which I kept from fresh install on localhost. On my fresh install I already set up multistore, domain names according to my previous steps, so: domain and ssl domain set to localhost, physical url set to /first_store_path/ and /second_store_path/ b ) /config/settings.inc.php, and this file turned out to be crucial. Besides setting database access, important settings are _COOKIE_KEY_, _COOKIE_IV_, _RIJNDAEL_KEY_, _RIJNDAEL_IV_. I set the first two to original values taken from live site, but the other two were missing on my live site. I eventually copied this entries from settings.inc.php from my fresh install on localhost, and turned out that this step was final. Everything just worked from there. So: cookies from live site, rijndael from localhost install. As for step 4 in above post: yes, you have to mess with ps_shop_url table in database. Domain and domain_ssl set to localhost, physical_url set to whatever path you chose for your stores: /first_store_path/, /second_store_path/. Yes, you have to set up alias in httpd.conf as described in above post: Alias /second_store_path "C:/xampp/htdocs/first_store_path". I really hope this is useful for somebody struggling with the same problem. Took a few months to get back to this problem and it's finally done
  6. Hello, I have quite big number of products, and I don't want to change number of displayed products every time I list them in admin. Is there any way to set default number of listed products from 50 to, let's say, 100? So far I found $_pagination array in AdminTab class, and I try to mess with AdminProductsController. Is it possible to affect only products listing in admin?
  7. 1. Try phpstorm. 2. What do you mean by frameworks? Prestashop widely uses bootstrap if you mean front-end frameworks. I always perceived module development as some sort of presta' framework. 3. You'll need to know some smarty. But the most important and first place to visit is prestashop's official documentation! It's all you need to know to start and good guidepost P.S. Oh, and one more: excellent site by @Nemo1.
  8. I had this error when deleted some of statuses by my boss' request. I had to reinsert status nr 2 manually via phpMyAdmin, This is weird, because this statuses should not be possible to delete. @EDIT: If someone's curious: you can always set up example prestashop, and look up this statuses in ps_order_state and ps_order_state_lang tables. Copy by id_order_state.
  9. In context of All Shops SSL is disabled. In shop with purchased certificate this option is overriden, SSL is enabled. For my other store, which does not have SSL certificate, option is left as disabled, same in Group: Default context. Thanks to your post I discovered how to make "Force SSL on all pages" appear. It happens when I enable SSL in All Shops context. Now it's visible in database. Not much use for me though. @EDIT: Maybe some sort of smarty debugging would be useful here. I'll try to follow this guide. I also tried using smarty's regex_replace and replace called on ssl part of link. I'm desperate. Maybe this is related to url rewriting? @EDIT2: I DID IT. This was easy and I am stupid. Blocktags module's .tpl was overriden inside my_template/modules/blocktags Changes applied there result with http links Thank you Bellini for interest and help, you're great.
  10. I encountered bug on this solution. If there are html tags involved and smarty's truncate:360 is still on place, in some cases buttons "add to cart", "quick view" etc are doubled. These cases are when smarty tries to truncate in the middle of html code, which is counted with the rest of short description. Solutions: 1) Remove truncate function: <div class="product-desc" itemprop="description"> {$product.description_short} </div> 2) If you still want to truncate, change '360' value to something else, for example: <div class="product-desc" itemprop="description"> {$product.description_short|truncate:760:'...'} </div> But this will apply to all of your short descriptions, so be careful, and check the result for every product on listing
  11. Yes, I meant ps_configuration table. Thank you for your attention. On my live store it looks like this: in ps_configuration there is no PS_SSL_ENABLED_EVERYWHERE, and when I click Please click here to use HTTPS protocol before enabling SSL on Preferences -> General, there is first a warning from my browser about SSL certificate (this is cheap certificate issued for only one of my stores, and I use multistore. Also I access admin panel from domain of shop with NO ssl certificate); then, when redirected to ssl admin, there is only one option: ENABLE SSL, which works fine in context of my shop which has issued certificate. Hovewer, if there is no PS_SSL_ENABLED_EVERYWHERE Configuration::get('PS_SSL_ENABLED_EVERYWHERE') equals to 0, is that right? protected function getBaseLink($id_shop = null, $ssl = null) { static $force_ssl = null; if ($ssl === null) { if ($force_ssl === null) $force_ssl = (Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE')); $ssl = $force_ssl; } if (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') && $id_shop !== null) $shop = new Shop($id_shop); else $shop = Context::getContext()->shop; $base = (($ssl && $this->ssl_enable) ? 'https://'.$shop->domain_ssl : 'http://'.$shop->domain); return $base.$shop->getBaseURI(); }
  12. 1. Yes, SSL is enabled of course. 2. No, in my panel there is no option like this. Does multistore have something to do with accessibility of this option? This is associated with PS_SSL_ENABLED_EVERYWHERE in configuration in database, right? As I said, there is no table like this in my database.
  13. Hello, I have very strange problem. In my tpl files of blockcms module and blocktags module I have $link->getPageLink() functions, which always result with ssl versions of links. The second parameter should be responsible for this, right? I am passing it like this: <a href="{$link->getPageLink($contact_url, null)|escape:'html'}" title="{l s='Contact us' mod='blockcms'}">{l s='Contact us' mod='blockcms'}</a> or <a href="{$link->getPageLink('search', null, NULL, "tag={$tag.name|urlencode}")|escape:'html'}" title="{l s='More about' mod='blocktags'} {$tag.name|escape:html:'UTF-8'}" class="{$tag.class} {if $smarty.foreach.myLoop.last}last_item{elseif $smarty.foreach.myLoop.first}first_item{else}item{/if}">{$tag.name|escape:html:'UTF-8'}</a> I couldn't find place where smarty's $link is assigned to php's $link, and I assumed it's done somewhere in global scope. In prestashop's link.php I traced all the way this second parameter's going, and all I found is dependency on PS_SSL_ENABLED_EVERYWHERE table in configuration. In my configuration there's nothing like that. I want to get rid of https on these links help
  14. I think this might be related to browser and auto-fill feature. Try clearing browser cache, using another browser. If it's so, your customers probably won't get this error. @EDIT: I highly recommend fix from this topic. It's excellent for hiding unused phone fields, making it optional etc.
×
×
  • Create New...