Jump to content

Roope

Members
  • Posts

    212
  • Joined

  • Last visited

Everything posted by Roope

  1. Hello guys! I'm starting to build a custom csv-import module and doing little pre testing here. Just playing with API and already in trouble.. Why I can't update Page input data with this one: $demo->setOutputFormatting(false); $demo->set('product_group', 1040); $demo->save(); When it works perfectly fine with text fields. How should I update it's value?
  2. Little addition to my previous post: when I throw 404 manually from page template, I get no errors and page renders and translates normally: throw new Wire404Exception(); But everytime system does it, I receive error described above.
  3. I have a problem with $page->localUrl() throwing error at 404 page: Fatal error: Exception: Method Page::localUrl does not exist or is not callable in this context (in /Users/Roope/Sites/demo/wire/core/Wire.php line 320) #0 /Users/Roope/Sites/demo/site/templates/inc/header.php(61): Wire->__call('localUrl', Array) #1 /Users/Roope/Sites/demo/site/templates/inc/header.php(61): Page->localUrl(Object(Language)) #2 /Users/Roope/Sites/demo/site/templates/basic.php(1): include('/Users/Roope/Si...') #3 /Users/Roope/Sites/demo/wire/core/TemplateFile.php(139): require('/Users/Roope/Si...') #4 [internal function]: TemplateFile->___render() #5 /Users/Roope/Sites/demo/wire/core/Wire.php(359): call_user_func_array(Array, Array) #6 /Users/Roope/Sites/demo/wire/core/Wire.php(317): Wire->runHooks('render', Array) #7 /Users/Roope/Sites/demo/wire/m in /Users/Roope/Sites/demo/index.php on line 214 In header.php around line 61 I have language switcher code borrowed from previous page: <?php echo '<ul>'; foreach($languages as $language) { if(!$page->viewable($language)) continue; // check if page not published for this language $class = "$language" == "$user->language" ? ' class="active"' : ''; $url = $page->localUrl($language); echo '<li'.$class.'><a href="'.$url.'">'.$language->title.'</a></li>'; } echo '</ul>'; I updated PW to latest dev but that didn't have any affect on this one. Besides 404 error, everything else runs smoothly. Any thoughts?
  4. OK, so this behaves as excepted. Defined image gets resized. But it overwrites the original file so this is not perfect solution for my need. Is there a way to make it create size variation from original without overwriting? I didn't find any options for this in ImageSizer class so how is it done in API? Should I just first copy and rename original image and resize that one?
  5. Yeah, Soma was suggesting this also when I made similar question couple of days ago - haven't got time to test it yet though, but will do it tonight. http://processwire.com/talk/topic/3539-resizing-images-outside-pw-folders/#entry34751
  6. It's working! I also noticed that I forgot to return value and was using wrong template selector at my previous attempt but this got the work done: $p = $pages->get($_GET['id']); return $pages->find("parent=$p->vendor, template=family"); Very nice. Thank you again Soma, you're always super helpful!
  7. Hello guys! I have a site where product template has Page field for Vendors and Product Families. All families allways belong under specific vendor so tree looks like this: Vendor 1Family A Family B Vendor 2Family C Family D I'd like to have only those families selectable that belong to selected vendor: If page has Vendor 1 selected, options for Families would be Family A and B. If there is no vendor set, then all families would be selectable. I've tried to set parent=$vendor, template=vendor and parent=$page->vendor, template=vendor for Custom selector in input tab but this throws error on page edit: Unknown Selector operator: '=$' -- was your selector value properly escaped? So variables don't seem to work here. I also tried $pages->find("parent=$page->vendor, template=vendor"); to Custom PHP field. This doesn't throw any errors but doesn't display any options either. Is this possible to achieve some way?
  8. Yep, this looks right - thanks Soma! And ImageSizer seems to create new image to the same path as original so I think this should work just fine. I'll test it and report findings here!
  9. Thanks for your reply sakkoulas! No, this isn't quite what im looking for since I wouldn't have any image field attached to product template. Situation is more like this: // set root for product images $root = $config->urls->root . 'images/'; // set product image filename using product sku number $name = $sanitizer->pageName($page->sku) . '_01.jpg'; // get product main image $image = file_exists($root.$name) ? $root.$name : null; // now, resize image using PW API if ($image) $image = $image->size(300,200);
  10. I'm also working on a project where I need cloning and I installed ProcessPageClone.module to do this. When I try to clone one (and only) product page I receive error: TemplateFile: Duplicate entry 'demotuote-1-1017' for key 'name1010_parent_id' INSERT INTO pages SET parent_id=1017, templates_id=46, name='demo-product-1-1', modified_users_id=41, status=1, sort=0,modified=NOW(), name1010='demotuote-1', name1011=NULL, created=NOW(), created_users_id=41 It seems to bug about duplicate entry for finnish name so is this module compatible with Multilanguage Page Names? Default language is english and name field for existing page is set to demo-product-1 (demotuote-1 in finnish translation).
  11. I'm building a product site where single product page wouldn't have any image field on it but instead we would use product images from another folder outside PW folders. All images are named using product SKU number that we store to text field during product import. Reason for this is that we already have images in place and we dont need (nor want) for images to be visible or uploadable through PW admin. Customer is used to mass update images via FTP and we don't want to break that. So question is, can we still use API to resize images or is it impossible outside wire array and filesystem?
  12. Yep, this got rid of errors - thanks Soma!
  13. Actually we do have a compiler molude which uses $config->scripts and $config->styles for fileset arrays. Basicly we override both arrays on frontend (would explain why $this->config->scripts isn't object anymore), but AdminHotKeys shouldn't do anythig there, am I right? PW version is latest public 2.3.0 and other installed third party plugins are: https://github.com/BlowbackDesign/emo https://github.com/niklaka/ProcessSelectorTest Plus Ryans: https://github.com/ryancramerdesign/ImportPagesCSV https://github.com/ryancramerdesign/ProcessExportProfile
  14. For some reason module throws error: Error: Call to a member function add() on a non-object (line 79 of /var/www/public_html/site/modules/AdminHotKeys/AdminHotKeys.module) Any idea why this is happening? I've unistalled module on public site and errors were gone, but when I downloaded files back to local, I got this same error - even when module was unistalled. I got site up and running by doing fresh install with mysql dump from ProcessExportProfile module.
  15. Roope

    Karena Savannah Cramer

    Midas touch! Congratulations Ryan.
  16. No I haven't but this looks really simple - as allways Will install it immediately, thanks! Anyway, it would be nice to have this media button to do what it supposed to and I thought to fix it my self but my knowledge doesn't get me that far since error is comming from Tinys compressed js file.
  17. I've added Insert/Edit Embedded Media button to TinyMCE and noticed error with YouTube and Vimeo links. Tiny changes video type correctly to HTML5 video and rewrites the url with both cases but when you click insert, fields go blank and nothing actually inserts to page content. It throws "TypeError: q is undefined" error from tiny_mce.js right after you set file url value.
  18. Thanks for your reply arjen! This wasn't quite what I was looking for though. I've made my own custom set of default fields and made sql-dump out of the config by Ryans profile export module to use as my default install. All field labels and descriptions are in english. So I'd like to include translation file for these custom default fields to my language pack. Can it be done?
  19. domain.com/drills was there just for example - I'm not saying it would be best policy or anything. Now I know how to achieve this in PW way if I choose to do so. Thanks alot Soma!
  20. What's the right way to build navigation links when using shorter URLs by URL segments? Page url still has folders in it so do I have to code links manually? Same with links inside richtext editor. EDIT: Or meta canonical tag: this will be pointing to uncorrect address if I make shorter URLs by URL segments: <link href="<?php echo $page->httpUrl; ?>" rel="canonical" />
  21. Thanks guys! You have to give me some credit since love between me and PW is only couple of weeks old. I think what happened here is that when I was looking first glance at PW admin I misunderstood URL segments. In MODX you can disable folder paths globally for the site and I thought URL segment would do same in PW for template basis. Shorty after I got URL segments right but still thought that I saw URL path option similar to MODX somewhere. Thanks for posting this article SiNNuT - haven't read it before and it clarified much about how to deal with URLs in PW. I'm myself a big fan of short and simple URLs. I prefer much more URL like domain.com/drills than domain.com/products/powertools/drills for example. It's good to now I can achive this using URL segments but it needs some hard coding and extra work compared to build in feature (like described above). With this project I'll do like Pete suggested and move vendors to seperate folder. All products can only belong to one vendor. Also product data from vendors come in different kind of CSVs. Info about vendor is something we don't want end-users to see. That's why first plan was to put products under vendor folders (to ease crawling for specific vendor data) and to put CSV import functionalities to vendor pages (that would be only visible for logged users).
  22. Cool! 100% coverage is definetly something to aim for. I think pull requests are way to go here. Additions could be committed to master and different terminology suggestions as new branches for easy testing. We're also used "sivupohja" for "template" translation. For non-technical user I think there's nothing wrong with "sivutyyppi" but might be bit misleading to more advanced user (eg. in MODX type is referenced to document/folder/weblink or contentType to html/css/js/xml..). For "name" we're used simply "URL nimi" - maybe too techy..
  23. Thanks Pete! Actually vendor pages are not needed in front-end so I don't need any data from these. We're building a site for our customer that holds product data from multiple vendors. We're planing to build some integration for product data import in scv-file. Reason why I would like to have page tree structured like in the example is that it would be easier to locate products under each vendor since there can be thousands of items per each. I think it's too messy to mix all products from all vendors under same folder. In MODX we're used to have setting for this in configuration. If URL paths is enabled, all pages use site tree like URL path structure. If disabled, it's just domain.com/pagename no matter where page sits in site tree. PW doesn't have this kind of feature? What if we would use templates without template files as vendor folder? Then page wouldn't be visible in URL path? We could still build inputs to admin area for csv import functions (using module) to this template am I right?
  24. Morjensta Apeisa! Do you have any plans to upload the package to Github? Since it's not 100% done it would be easier to contribute.
×
×
  • Create New...