Jump to content

valan

Members
  • Posts

    303
  • Joined

  • Last visited

Everything posted by valan

  1. Hi slkwrm! Thank you for advise - I've changed selector to page name and it start to work without errors! It is clear now, that problem is in title field. Taking into account that title field is multi-language, I guess problem is in Language module. Somehow it doesn't create column 'field_title.data1439' where 1439 is language page until next run of the same php script......... and this surprises me even more then error. Sanitation didn't help, it reproduces the same error. I also use English language in selector. So far workaround with page name looks OK for me, but we need to fix original problem or at least understand why it happens - it makes me feel less certain with selectors over multi-language fields now.....
  2. Any of these have the same result... Error: Exception: Unknown column 'field_title.data1439' in 'where clause' (in /share/MD0_DATA/Web/pw/wire/core/Database.php line 118) $p = $parentpage->child($selector); $p = $parentpage->children($selector)->first(); $p = $wire->pages->find($selector)->first(); By the way, 1439 is a default language page. Looks like language module somehow related to the error...
  3. I've spent few hours at this problem but looks like it needs attention from more qualified people - (1) there is function like this: function save_vehicle($wire, $titles) { $default = $wire->languages->get("default"); // retrieve English $russian = $wire->languages->get("russian"); // retrieve Russian $wire->user->language = $default; // whatever current language is, switch it default (English) $parentpage = $wire->pages->get('/vehicles/'); $selector = 'template=vehicle-category, title="'.$titles[1].'"'; $p = $parentpage->child($selector); // do we already have this category? if(!$p->id) { $p = new Page(); $p->template = 'vehicle-category'; $p->parent = $parentpage; // get parent page $p->of(false); $p->title->setLanguageValue($default, $titles[1]); // set in English $p->title->setLanguageValue($russian, $titles[0]); // set in Russian $p->name = $wire->sanitizer->pageName($titles[1]); $p->save(); // save the page with the two language values } (2) this function is called in a cycle (3) when it is is called first time in a cycle - everything is OK, if creates new page as I expect (4) when it is called second time with same arguments, it produces error in row $p = $parentpage->child($selector); Error: Exception: Unknown column 'field_title.data1439' in 'where clause' (in /share/MD0_DATA/Web/pw/wire/core/Database.php line 118) (5) the strange thing (at least for me) is that when I run this cycle once again - everything is OK, e.g. selector works, script detects that page with such title exists and doesn't create new page. Please help. Thanks in advance!
  4. slkwrm, thank you for trick idea! I've checked which field can cause error and looks like problem could be in a concat field. Its $inputfield is always NULL. I think I can delete and see what happens, but if the problem is not installation-specific, then it may be interesting for Ryan before deletion. Ryan, hi! I'll drop you a note with details into the mailbox. Thank you for attention!
  5. Hello! I've checked the forum but haven't found anything like this - Page can't be opened for editing when user (admin) is switched to different from default language and attempts to edit page based on one of templates. Error as below appears. When user is switched to default (English) language, everything works fine. Pages based on other templates are also editable independently on user language. E.g. problem is clearly localized in that "problematic" template. If user attempts to create new page with this template in non-default language - the same error, but PW creates page. It just do not pass user to field edit screens, showing the error. This template is the most complex one, with around 50 fields of all kind. Initially I thought that problem could be in few "custom areas", but currently they are removed but problem persists. I'll mention these areas here just in case it could somehow influence even being removed... (1) there was a custom module that hooked savePage event to change values in some fields of this template. Currently uninstalled. (2) there were Page fields with custom PHP select, like "return $page->parent;". Currently fields removed. I can try do dig deeper, but currently can't understand in which direction... Any help is appreciated! Thanks! Strict Standards: Creating default object from empty value in /share/MD0_DATA/Web/zeerq/wire/modules/LanguageSupport/LanguageSupport.module on line 380 Catchable fatal error: Argument 1 passed to InputfieldWrapper::add() must be an instance of Inputfield, instance of stdClass given, called in /share/MD0_DATA/Web/zeerq/wire/core/Fieldgroup.php on line 342 and defined in/share/MD0_DATA/Web/zeerq/wire/core/InputfieldWrapper.php on line 139
  6. Hi Soma! As usual - thank you for valuable recommendations! I found mistype (compared initial and new modules): module name started with lowercase "zeerqhooks". Changed it to "Zeerqhooks" in the db and removed trailing ?> - after that everything works as intended! Somehow I've missed in docs that filename should be 100% class name. Also thanks for debug trick - it saves hours!
  7. Newbie journey into PW continues... )) Chronology of events: (1) Modified Helloworld module to add hook that updates several fields, when page is planned to be saved (see appendix) (2) Installed OK (3) Module doesn't work as intended... (e.g. fields are not updated, but also no any errors) (4) Trying to uninstall module, but module link doesn't open from admin>modules - some session error appears. (5) Physically replacing module file with updated one and trying to install - the following appears... TemplateFile: Duplicate entry 'Zeerqhooks' for key 'class' INSERT INTO modules SET class='Zeerqhooks', flags=3, data='' (6) OK. physically removing module file. It disappears in admin>modules (7) Placing module file on the same place. It appears in admin>modules, but error in p.5 repeats... Please advice how to uninstall first, non-accessible module in order to install new one? And what's wrong with the code? Thanks for any help! Appendix: Zeerqhooks.module <?php class Zeerqhooks extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'ZEERQ Hooks', 'version' => 101, 'summary' => 'ZEERQ hooks module updates 5 fields when vehicle page is saved', 'singular' => true, 'autoload' => true, ); } public function init() { $this->addHookAfter('Pages::saveReady', $this, 'updateFields'); } public function updateFields($event) { $page = $event->object; // don't update fields in any page other then vehicle if($page->template != 'vehicle') return; // update all 5 fields $page->vehicle_ui_category = $page->parent->parent->parent->parent->parent; $page->vehicle_ui_type = $page->parent->parent->parent->parent; $page->vehicle_ui_brand = $page->parent->parent->parent; $page->vehicle_ui_model = $page->parent->parent; $page->vehicle_ui_modification = $page->parent; } } ?>
  8. Soma, Wanze - thank you! My solution may be not very elegant, but definitely quick )))
  9. I found creative way to fix the problem! HTML inspection in Chrome over empty raws has shown that there are empty <a> tages which I manually filled with qwerty text. After that page became accessible with all edit/move/delete links near it. )))
  10. yes, seems that titles were not created but pages were created... so since created pages are not accessible, I can't enter pages and delete them...
  11. Cant't fix problem caused by custom PHP code for selectable pages (I'm experimenting with "dependable" fields). The code is as below: $country = $page->address_country; $state = $page->address_state; $pages->get("/db/country-specific/")->find("title=$country")->children("title=Locations")->children("title=$state")->children; When I'm trying to save new page, I get: Method PageArray::children does not exist or is not callable in this context Now, problem is that few pages that I've managed to create with this code are invisible and inaccessible (see picture). Does anybody know how to delete them? I guess I need to go to PhpMyAdmin? Or it can be fixed within PW admin? Thanks in advance!! Also, as far as I understand, code doesn't work as address_country and address_state fields are not defined yet in NEW page... Please correct. Thanks!
  12. WOW!!! It works! Wanze, thank you for help! - I've started to think that problem doesn't have elegant solutions in PW. But you proved that PW has such solution! P.S. hope to see this kind of hints documented sometime by core PW team!
  13. Meanwhile, discovered why echo $user->fields->get("some_text_field")->label->getLanguageValue($user->language) doesn't work. It is because $user->fields->get("some_text_field")->label returns string. Yes, I'm newbie ))) Still trying to find access to another translation in my field's label field... w/o success after another portion of experiments...
  14. I've spent few hours at this problem, but still can't solve it - // this code works not as expected - outputs only in default language, even if $user->language is different. echo $user->fields->get("some_text_field")->label; // while this code in the same php file works as expected - output follows $user->language echo $page->any_field; Note: some_text_field field label is a multi-language field, all translations available. If I try to do something like this: echo $user->fields->get("some_text_field")->label->getLanguageValue($user->language); it returns: Please, help - I want to output field label in current language! )) Thanks!
  15. Ryan, thank you for the answer! Clear now. Also great to know that field dependencies are coming!!
  16. Hi! I plan to build complex input form that: - will have dependable select fields, processed through ajax, e.g. address (country->region->city) - will have nested sub-forms, opened by click in modal window - will have custom CSS design Comparable example of input form and how it is processed - Facebook edit profile page. Would you recommend to use Form Builder for such kind of input form development or it is better to write something from the scratch?
  17. Hi diogo! Good question. I've mentioned in my reply to Wanze that attribute pages (ones, that editor selects within each repeater item) have few other fields, particularly attribute category and attribute measure. So editor doesn't fill category and measure in each page. It can be done in attribute page only. E.g. I would agree with you and Wanze that use of fields instead of repeater is probably more optimal in cases when there are no additional fields associated with attribute. But in my case - not sure... too many fields in a page.
  18. Hi Wanze! I should probably add from the very beginning that attribute pages (ones, that editor selects within each repeater item) have few other fields, particularly attribute category and attribute measure. For example, "length" attribute has "carcass" category and "cm" measure. So later during rendering attributes are grouped by category and values have measures. In this case I have to add 50*3 attribute fields (name, category, measure) + 50 value fields into the page... it is too much... Nevertheless, thanks for idea with foreach ($page->fields...) - quite useful PW feature that I've never used before! I guess that my question touches more fundamental things in PW. As far as I understand, currently PW pages are "field-static". I believe that introduction of a "dependable field" (field that PW dynamically substitutes based on "parent" field value within a page, using rules predefined by developer) in PW pages could attract more sophisticated projects.
  19. Hi Wanze! Thanks for suggestion. (1) Repeater is used because number of required attributes vary from car to car. E.g. there is no reason to keep 50+ attributes in a car page where only 10 attributes are used. (2) Repeater is a great way to write short code that renders attributes and values in foreach cycle. With fields, developer needs to write 50+ lines (render each field). Also if you use repeater, you don't worry if attribute name has changed. If you use fields, you need to update code. E.g. fields are OK, but not so elegant in my mind.
  20. Hi! I'm trying to find optimal solution for "cars database" site I'm currently developing. Background: Each car has variable but limited list of attributes: model, length, number of seats, color, etc - total more than 50 attributes that average consumer is interested to know. Each attribute has value, e.g. model=BMW 3er 318i, length=5.5m, number of seats=5, color=black. These attributes and their values are added in the repeater field of car page, where attributes are selected from available limited list (page select field type) while values are entered manually (text field). Repeater is used because number of required attributes vary from car to car. Problem: Depending on attribute, some value fields need to be "selectable" and some not. For example, if attribute is "color", then available through select values should be "black" and "white". Other value field should not be "selectable", e.g. "length" attribute could have any decimal value. So far, I haven't found an elegant way to make such dependency and value selection (only when it is needed) within repeater. Do you know an elegant way how to make PW work as I need? I'd like to make life of content manager (person who enters cars data into the db) a bit easier. ) Thanks for help!
  21. Hello professional PW world! Not being a developer/designer myself (its rather my hobby), I've liked PW for its simplicity and flexibility and even developed simple site with it. However more complex sites require time to grow professionalism in PHP/JS/design/etc - something that I can't get quickly and without impact on my main work. As a result, I'd like to post job here. In brief - I'm looking for professional PW + PHP developer for full-cycle PW-powered site development. Site will be analogy of coachup.com. Differences come from content that will be provided during development (another business area, specifically, education + content language is Russian (but I'll need to leave possibility to easily switch to other languages)). All the rest (front-end design concept, site structure, frond-end and back-end functionality, etc) is the same. Please check this site to get full picture and understand scope of work. Take into account that functionality includes work with external APIs: authorization from social sites, Google maps, payment gateway, support chat. Hope this helps to estimate budget and time. Please contact me with questions and proposals at andrey.valiev@hotmail.com. Or leave comments here. Thank you! Best regards, Andrey P.S. As I plan to develop few other PW-powered sites, more job may come.
  22. wow! super! it works! where these pieces of wisdom can be found on the site? I'll be happy to read document like "PW admin guide"... Thanks a lot!
  23. I'm creating a db of objects - hidden pages (cars) within PW. Perhaps not good in terms of site performance, but anyway... Car page has "foreign key" - vendor page in a form of a Page field select. Admin cars page list displays these vendor pages IDs, and here is my problem - for readability/convenience I need to display content of some field (vendor_name) within that Page, not its ID. What can be done in such cases? May be there exists some approach for page-in-page selection and admin display of fields from that sub-page?
  24. Code works perfectly, but I guess that changes in 'user' template (as well as in any other built-in templates) is not good as changes have to be applied again after each PW upgrade. Correct? If yes, what is the best way to avoid this? Perhaps workaround could be to keep usernames/passwords/emails in admin template and create custom 'site-user' template which can keep any other fields ('tmp-pass' in this case). This also requires unique key to match PW user and 'site-user' in the code, and can be done with help of username or email field (must be added to 'site-user' template). Please advice if logic regarding usage of admin templates is correct and workaround is optimal. Thanks!
×
×
  • Create New...