From db at m-and-d.com Sun Apr 26 15:36:40 2015 From: db at m-and-d.com (DB) Date: Sun, 26 Apr 2015 11:36:40 -0400 Subject: [ic] Specify flypage using javascript or another non-database method Message-ID: <553D0608.3090105@M-and-D.com> Hi all. I'm working an making IC5 site a bit more mobile friendly and so far it's been fairly painless. Using javascript to redirect mobile visitors to the mobile version of a page works well. But I now need a way to make mobile visitors see a different flypage than non-mobile visitors see. PageSelectField looks like one way to change the flypage on a per-product basis but that's not what I need here. Can anyone think of a way to change the flypage using javascript or ome other non-database method? Thanks for any ideas! DB From mikeh at perusion.com Sun Apr 26 16:38:53 2015 From: mikeh at perusion.com (Mike Heins) Date: Sun, 26 Apr 2015 12:38:53 -0400 Subject: [ic] Specify flypage using javascript or another non-database method In-Reply-To: <553D0608.3090105@M-and-D.com> References: <553D0608.3090105@M-and-D.com> Message-ID: <20150426163853.GA840@kim.perusion.com> Quoting DB (db at m-and-d.com): > Hi all. I'm working an making IC5 site a bit more mobile friendly and so > far it's been fairly painless. Using javascript to redirect mobile > visitors to the mobile version of a page works well. But I now need a > way to make mobile visitors see a different flypage than non-mobile > visitors see. > > PageSelectField looks like one way to change the flypage on a > per-product basis but that's not what I need here. Can anyone think of a > way to change the flypage using javascript or ome other non-database > method? Thanks for any ideas! Surely you can detect the presence of a mobile browser? If so, you can easily do: Sub change_fp <is_mobile(); $Config->{SpecialPage}->{flypage} = 'mflypage'; return; } EOR Autoload change_fp -- Mike Heins Perusion -- Expert Interchange Consulting http://www.perusion.com/ phone +1.765.253.4194 There is something fascinating about science. One gets such wholesale returns of conjecture out of such a trifling investment of fact. -- Mark Twain From db at m-and-d.com Sun Apr 26 19:10:58 2015 From: db at m-and-d.com (DB) Date: Sun, 26 Apr 2015 15:10:58 -0400 Subject: [ic] Re: Specify flypage using javascript or another non-database method In-Reply-To: <20150426163853.GA840@kim.perusion.com> References: <20150426163853.GA840@kim.perusion.com> Message-ID: <553D3842.7000108@M-and-D.com> >> Hi all. I'm working an making IC5 site a bit more mobile friendly and so >> far it's been fairly painless. Using javascript to redirect mobile >> visitors to the mobile version of a page works well. But I now need a >> way to make mobile visitors see a different flypage than non-mobile >> visitors see. >> >> PageSelectField looks like one way to change the flypage on a >> per-product basis but that's not what I need here. Can anyone think of a >> way to change the flypage using javascript or ome other non-database >> method? Thanks for any ideas! > > Surely you can detect the presence of a mobile browser? If so, > you can easily do: > > Sub change_fp < sub { > return unless $Tag->is_mobile(); > $Config->{SpecialPage}->{flypage} = 'mflypage'; > return; > } > EOR > > Autoload change_fp > > -- > Mike Heins > Perusion -- Expert Interchange Consulting http://www.perusion.com/ > phone +1.765.253.4194 Thanks - I'd been using something like below but I see other ways in the archives that would probably work better with your example. From peter at pajamian.dhs.org Sun Apr 26 23:41:42 2015 From: peter at pajamian.dhs.org (Peter) Date: Mon, 27 Apr 2015 11:41:42 +1200 Subject: [ic] Specify flypage using javascript or another non-database method In-Reply-To: <553D3842.7000108@M-and-D.com> References: <20150426163853.GA840@kim.perusion.com> <553D3842.7000108@M-and-D.com> Message-ID: <553D77B6.3050809@pajamian.dhs.org> On 04/27/2015 07:10 AM, DB wrote: >>> Hi all. I'm working an making IC5 site a bit more mobile friendly and so >>> far it's been fairly painless. Using javascript to redirect mobile >>> visitors to the mobile version of a page works well. But I now need a >>> way to make mobile visitors see a different flypage than non-mobile >>> visitors see. > Thanks - I'd been using something like below but I see other ways in the > archives that would probably work better with your example. > > Using javascript is all well and good, but you do have to direct them after the page is loaded and then load another page as a result. If you use server-side code to detect the presence of a mobile based on the UserAgent string then you can use Mike's code above to do it without needing a redirect. I suggest using the HTTP::BrowserDetect module to parse the useragent string for you. It has, among others, methods that tell you if it's a mobile device and whether it's a tablet, etc. Peter From mikeh at perusion.com Mon Apr 27 00:25:00 2015 From: mikeh at perusion.com (Mike Heins) Date: Sun, 26 Apr 2015 20:25:00 -0400 Subject: [ic] Specify flypage using javascript or another non-database method In-Reply-To: <553D77B6.3050809@pajamian.dhs.org> References: <20150426163853.GA840@kim.perusion.com> <553D3842.7000108@M-and-D.com> <553D77B6.3050809@pajamian.dhs.org> Message-ID: <20150427002459.GA20556@kim.perusion.com> Quoting Peter (peter at pajamian.dhs.org): > On 04/27/2015 07:10 AM, DB wrote: > >>> Hi all. I'm working an making IC5 site a bit more mobile friendly and so > >>> far it's been fairly painless. Using javascript to redirect mobile > >>> visitors to the mobile version of a page works well. But I now need a > >>> way to make mobile visitors see a different flypage than non-mobile > >>> visitors see. > > > Thanks - I'd been using something like below but I see other ways in the > > archives that would probably work better with your example. > > > > > > Using javascript is all well and good, but you do have to direct them > after the page is loaded and then load another page as a result. If you > use server-side code to detect the presence of a mobile based on the > UserAgent string then you can use Mike's code above to do it without > needing a redirect. I suggest using the HTTP::BrowserDetect module to > parse the useragent string for you. It has, among others, methods that > tell you if it's a mobile device and whether it's a tablet, etc. I think you can find the is_mobile tag in our repository, it is something we use for the Strap catalog, I believe. If not, here it is: UserTag is_mobile hasEndTag UserTag is_mobile Routine <{mobile_browser}) { my $ua = HTTP::BrowserDetect->new($Vend::Session->{browser}); if($ua->mobile()) { $Vend::Session->{mobile_browser} = 1; } else { $Vend::Session->{mobile_browser} = 0; } } return $Vend::Session->{mobile_browser} ? Vend::Interpolate::pull_if(shift (@_)) : Vend::Interpolate::pull_else(shift (@_) ); } EOR -- Mike Heins Perusion -- Expert Interchange Consulting http://www.perusion.com/ phone +1.765.253.4194 Celebrate Diversity... except veterans, small-business owners, practicing Catholics, gun owners, talk-radio listeners, tea-party attendees, Texans, smokers, limited- government proponents, pro-lifers, taxpayers, NASCAR fans, Boy Scouts, oil-company employees, secure-border advocates, capitalists, global- warming agnostics, Cuban refugees, school-choicers.. -- Peter Kirsanow From josh at perusion.com Mon Apr 27 15:19:06 2015 From: josh at perusion.com (Josh Lavin) Date: Mon, 27 Apr 2015 08:19:06 -0700 Subject: [ic] Specify flypage using javascript or another non-database method In-Reply-To: <20150427002459.GA20556@kim.perusion.com> References: <20150426163853.GA840@kim.perusion.com> <553D3842.7000108@M-and-D.com> <553D77B6.3050809@pajamian.dhs.org> <20150427002459.GA20556@kim.perusion.com> Message-ID: <20150427151906.GO4456@kate.perusion.com> Quoting Mike Heins (mikeh at perusion.com): > Quoting Peter (peter at pajamian.dhs.org): > > On 04/27/2015 07:10 AM, DB wrote: > > >>> Hi all. I'm working an making IC5 site a bit more mobile friendly and so > > >>> far it's been fairly painless. Using javascript to redirect mobile > > >>> visitors to the mobile version of a page works well. But I now need a > > >>> way to make mobile visitors see a different flypage than non-mobile > > >>> visitors see. > > > > > Thanks - I'd been using something like below but I see other ways in the > > > archives that would probably work better with your example. > > > > > > > > > > Using javascript is all well and good, but you do have to direct them > > after the page is loaded and then load another page as a result. If you > > use server-side code to detect the presence of a mobile based on the > > UserAgent string then you can use Mike's code above to do it without > > needing a redirect. I suggest using the HTTP::BrowserDetect module to > > parse the useragent string for you. It has, among others, methods that > > tell you if it's a mobile device and whether it's a tablet, etc. > > I think you can find the is_mobile tag in our repository, it is something > we use for the Strap catalog, I believe. If not, here it is: >From here: https://github.com/perusion/interchange-extras/tree/master/mobile -- Josh Lavin Perusion -- Expert Interchange Consulting http://www.perusion.com/ ... ask me about job opportunities ... From scaballe at gmail.com Tue Apr 28 20:50:15 2015 From: scaballe at gmail.com (Salvador Caballe) Date: Tue, 28 Apr 2015 22:50:15 +0200 Subject: [ic] query error in products search Message-ID: <553FF287.6030700@gmail.com> Hi all. I use the following code in the promo component to show only items in stock [query arrayref=main SELECT m.sku, m.timed_promotion, m.start_date, m.finish_date FROM [either]__UI_MERCH_TABLE__[or]merchandising[/either] m, inventory i WHERE m.featured = '[control promo_type specials]' AND i.sku = m.sku AND i.quantity >= 1 "][/query] runs OK, but now I try to use locale options in the products database, and I have the following error: Died in server spawn: Bad column name (from m.sku): 'm.sku' at /home/interch/interchange/lib/Vend/SQL_Parser.pm line 838. The database configuration is: Database products products.txt __SQLDSN__ Database products KEY sku Database products HIDE_FIELD inactive Database products COLUMN_DEF "sku=char(64) NOT NULL PRIMARY KEY" Database products COLUMN_DEF "description=varchar(128) NOT NULL" Database products COLUMN_DEF "title=varchar(128) DEFAULT '' NOT NULL" Database products INDEX title Database products COLUMN_DEF "template_page=varchar(64)" Database products COLUMN_DEF "comment=TEXT" Database products COLUMN_DEF "thumb=varchar(128)" Database products COLUMN_DEF "image=varchar(64)" Database products COLUMN_DEF "price=DECIMAL(12,2) NOT NULL" Database products INDEX price Database products COLUMN_DEF "category=varchar(64) NOT NULL DEFAULT ''" Database products INDEX category Database products COLUMN_DEF "prod_group=varchar(64) NOT NULL DEFAULT ''" Database products INDEX prod_group Database products COLUMN_DEF "nontaxable=CHAR(3)" Database products COLUMN_DEF "weight=varchar(12) DEFAULT '0' NOT NULL" Database products COLUMN_DEF "size=varchar(96)" Database products COLUMN_DEF "color=varchar(96)" Database products COLUMN_DEF "author=varchar(255)" Database products COLUMN_DEF "related=text" Database products COLUMN_DEF "featured=varchar(32)" Database products COLUMN_DEF "inactive=varchar(3) DEFAULT ''" Database products COLUMN_DEF "gift_cert=varchar(3) DEFAULT ''" Database products NUMERIC price Variable CURLOCALE es_ES include dbconf/locales/default.cfg # Options Database options MAP_OPTIONS share __CURLOCALE__ options___CURLOCALE__ Database options MAP o_label __CURLOCALE__ options___CURLOCALE__::o_label Database options MAP description __CURLOCALE__ options___CURLOCALE__::description ifdef SQLDSN Database options___CURLOCALE__ options___CURLOCALE__.txt __SQLDSN__ endif ifndef SQLDSN Database options___CURLOCALE__ options___CURLOCALE__.txt TAB endif # Products Database products MAP_OPTIONS share __CURLOCALE__ products___CURLOCALE__ area area___CURLOCALE__ cat cat___CURLOCALE__ Database products MAP description __CURLOCALE__ products___CURLOCALE__::description Database products MAP description fallback 1 Database products MAP title __CURLOCALE__ products___CURLOCALE__::title Database products MAP title fallback 1 Database products MAP comment __CURLOCALE__ products___CURLOCALE__::comment Database products MAP comment fallback 1 Database products MAP prod_group __CURLOCALE__ products___CURLOCALE__::prod_group Database products MAP prod_group fallback 1 Database products MAP category __CURLOCALE__ products___CURLOCALE__::category Database products MAP category fallback 1 ifdef SQLDSN Database products___CURLOCALE__ products___CURLOCALE__.txt __SQLDSN__ Database products___CURLOCALE__ COLUMN_DEF "sku=char(64) NOT NULL PRIMARY KEY" Database products___CURLOCALE__ COLUMN_DEF "description=varchar(128) NOT NULL" Database products___CURLOCALE__ COLUMN_DEF "title=varchar(128) DEFAULT '' NOT NULL" Database products___CURLOCALE__ COLUMN_DEF "comment=TEXT" Database products___CURLOCALE__ COLUMN_DEF "category=varchar(64) NOT NULL DEFAULT ''" Database products___CURLOCALE__ COLUMN_DEF "prod_group=varchar(64) NOT NULL DEFAULT ''" endif ifndef SQLDSN Database products___CURLOCALE__ products___CURLOCALE__.txt TAB endif best regards Salvador Caball? From scaballe at gmail.com Wed Apr 29 19:34:59 2015 From: scaballe at gmail.com (Salvador Caballe) Date: Wed, 29 Apr 2015 21:34:59 +0200 Subject: [ic] query error in products search - more Info In-Reply-To: <553FF287.6030700@gmail.com> References: <553FF287.6030700@gmail.com> Message-ID: <55413263.4080603@gmail.com> > Hi all. > > I use the following code in the promo component > to show only items in stock > > [query arrayref=main > > SELECT m.sku, m.timed_promotion, m.start_date, m.finish_date > FROM [either]__UI_MERCH_TABLE__[or]merchandising[/either] m, inventory i > WHERE m.featured = '[control promo_type specials]' > AND i.sku = m.sku > AND i.quantity >= 1 > > "][/query] > > > runs OK, but now I try to use locale options in the products database, and I have the following error: > > Died in server spawn: Bad column name (from m.sku): 'm.sku' at /home/interch/interchange/lib/Vend/SQL_Parser.pm line 838. More info: No errors with a single table SQL query if I disable the localized products table, #Variable CURLOCALE es_ES #include dbconf/locales/default.cfg and restarts Interchange the 2 tables SQL query works OK and no errors Seems a bug in SQL_Parser.pm Salvador From racke at linuxia.de Thu Apr 30 06:42:17 2015 From: racke at linuxia.de (Stefan Hornburg (Racke)) Date: Thu, 30 Apr 2015 08:42:17 +0200 Subject: [ic] query error in products search In-Reply-To: <553FF287.6030700@gmail.com> References: <553FF287.6030700@gmail.com> Message-ID: <5541CEC9.8030303@linuxia.de> On 04/28/2015 10:50 PM, Salvador Caballe wrote: > Hi all. > > I use the following code in the promo component > to show only items in stock > > [query arrayref=main > > SELECT m.sku, m.timed_promotion, m.start_date, m.finish_date > FROM [either]__UI_MERCH_TABLE__[or]merchandising[/either] m, inventory i > WHERE m.featured = '[control promo_type specials]' > AND i.sku = m.sku > AND i.quantity >= 1 > > "][/query] > > > runs OK, but now I try to use locale options in the products database, and I have the following error: > > Died in server spawn: Bad column name (from m.sku): 'm.sku' at /home/interch/interchange/lib/Vend/SQL_Parser.pm line 838. Unfortunately the support for MAP and queries using multiple tables is limited / missing. Regards Racke > > > The database configuration is: > > Database products products.txt __SQLDSN__ > Database products KEY sku > Database products HIDE_FIELD inactive > Database products COLUMN_DEF "sku=char(64) NOT NULL PRIMARY KEY" > Database products COLUMN_DEF "description=varchar(128) NOT NULL" > Database products COLUMN_DEF "title=varchar(128) DEFAULT '' NOT NULL" > Database products INDEX title > Database products COLUMN_DEF "template_page=varchar(64)" > Database products COLUMN_DEF "comment=TEXT" > Database products COLUMN_DEF "thumb=varchar(128)" > Database products COLUMN_DEF "image=varchar(64)" > Database products COLUMN_DEF "price=DECIMAL(12,2) NOT NULL" > Database products INDEX price > Database products COLUMN_DEF "category=varchar(64) NOT NULL DEFAULT ''" > Database products INDEX category > Database products COLUMN_DEF "prod_group=varchar(64) NOT NULL DEFAULT ''" > Database products INDEX prod_group > Database products COLUMN_DEF "nontaxable=CHAR(3)" > Database products COLUMN_DEF "weight=varchar(12) DEFAULT '0' NOT NULL" > Database products COLUMN_DEF "size=varchar(96)" > Database products COLUMN_DEF "color=varchar(96)" > Database products COLUMN_DEF "author=varchar(255)" > Database products COLUMN_DEF "related=text" > Database products COLUMN_DEF "featured=varchar(32)" > Database products COLUMN_DEF "inactive=varchar(3) DEFAULT ''" > Database products COLUMN_DEF "gift_cert=varchar(3) DEFAULT ''" > Database products NUMERIC price > > Variable CURLOCALE es_ES > include dbconf/locales/default.cfg > > # Options > Database options MAP_OPTIONS share __CURLOCALE__ options___CURLOCALE__ > Database options MAP o_label __CURLOCALE__ options___CURLOCALE__::o_label > Database options MAP description __CURLOCALE__ options___CURLOCALE__::description > ifdef SQLDSN > Database options___CURLOCALE__ options___CURLOCALE__.txt __SQLDSN__ > endif > ifndef SQLDSN > Database options___CURLOCALE__ options___CURLOCALE__.txt TAB > endif > > # Products > Database products MAP_OPTIONS share __CURLOCALE__ products___CURLOCALE__ area area___CURLOCALE__ cat cat___CURLOCALE__ > Database products MAP description __CURLOCALE__ products___CURLOCALE__::description > Database products MAP description fallback 1 > Database products MAP title __CURLOCALE__ products___CURLOCALE__::title > Database products MAP title fallback 1 > Database products MAP comment __CURLOCALE__ products___CURLOCALE__::comment > Database products MAP comment fallback 1 > Database products MAP prod_group __CURLOCALE__ products___CURLOCALE__::prod_group > Database products MAP prod_group fallback 1 > Database products MAP category __CURLOCALE__ products___CURLOCALE__::category > Database products MAP category fallback 1 > ifdef SQLDSN > Database products___CURLOCALE__ products___CURLOCALE__.txt __SQLDSN__ > Database products___CURLOCALE__ COLUMN_DEF "sku=char(64) NOT NULL PRIMARY KEY" > Database products___CURLOCALE__ COLUMN_DEF "description=varchar(128) NOT NULL" > Database products___CURLOCALE__ COLUMN_DEF "title=varchar(128) DEFAULT '' NOT NULL" > Database products___CURLOCALE__ COLUMN_DEF "comment=TEXT" > Database products___CURLOCALE__ COLUMN_DEF "category=varchar(64) NOT NULL DEFAULT ''" > Database products___CURLOCALE__ COLUMN_DEF "prod_group=varchar(64) NOT NULL DEFAULT ''" > endif > ifndef SQLDSN > Database products___CURLOCALE__ products___CURLOCALE__.txt TAB > endif > > > > best regards > Salvador Caball? > > _______________________________________________ > interchange-users mailing list > interchange-users at icdevgroup.org > http://www.icdevgroup.org/mailman/listinfo/interchange-users -- Modern Perl, Dancer and eCommerce consulting. From scaballe at gmail.com Thu Apr 30 07:47:18 2015 From: scaballe at gmail.com (Salvador Caballe) Date: Thu, 30 Apr 2015 09:47:18 +0200 Subject: [ic] query error in products search In-Reply-To: <5541CEC9.8030303@linuxia.de> References: <553FF287.6030700@gmail.com> <5541CEC9.8030303@linuxia.de> Message-ID: <5541DE06.1080106@gmail.com> El 30/04/15 a les 08:42, Stefan Hornburg (Racke) ha escrit: > On 04/28/2015 10:50 PM, Salvador Caballe wrote: >> Hi all. >> >> I use the following code in the promo component >> to show only items in stock >> >> [query arrayref=main >> >> SELECT m.sku, m.timed_promotion, m.start_date, m.finish_date >> FROM [either]__UI_MERCH_TABLE__[or]merchandising[/either] m, inventory i >> WHERE m.featured = '[control promo_type specials]' >> AND i.sku = m.sku >> AND i.quantity >= 1 >> >> "][/query] >> >> >> runs OK, but now I try to use locale options in the products database, and I have the following error: >> >> Died in server spawn: Bad column name (from m.sku): 'm.sku' at /home/interch/interchange/lib/Vend/SQL_Parser.pm line 838. > > Unfortunately the support for MAP and queries using multiple tables is limited / missing. > > Regards > Racke > >> Is possible to do the same multimple table query with interchange search instead SQL ?? Salvador