Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#865 2017-07-28 15:05:03

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,303

Re: yab_shop (simple textpattern shop with paypal support)

kjeld, I’ve once bookmarked this post from Ruud, where he sets a pref value explicitly only in a certain situation, filtered via conditional tags. I hope there’s an equivalent of setting last-modified that way.


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#866 2017-07-28 19:12:07

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: yab_shop (simple textpattern shop with paypal support)

Can’t be done via a tag, because the last modified header is sent before the page is parsed.
It should be possible by hooking into this callback_event, and if the request_uri matches, change the last modified pref (for the current request, not in the database):
callback_event('pretext_end');

Offline

#867 2017-07-28 22:44:32

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 446
Website

Re: yab_shop (simple textpattern shop with paypal support)

ruud wrote #306476:

Can’t be done via a tag, because the last modified header is sent before the page is parsed.
It should be possible by hooking into this callback_event, and if the request_uri matches, change the last modified pref (for the current request, not in the database):
callback_event('pretext_end');

Thank you for the quick feedback, uli and ruud.

This explanation goes quite over my head, I am afraid. Do I understand correctly that you suggest creating a php function?

Unfortunately, I haven’t mastered php. What would the complete function look like and where would I need to add it?


Old Photos of Japan – Japan in the 1850s~1960s (100% txp)
MeijiShowa – Stock photos of Japan in the 1850s~1960s (100% txp)
JapaneseStreets.com – Japanese street fashion (mostly txp)

Offline

#868 2017-07-29 06:30:30

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: yab_shop (simple textpattern shop with paypal support)

Edit the yab_shop_core plugin and add this at the top:

register_callback('yab_shop_modified', 'pretext_end');

function yab_shop_modified() {
  global $prefs, $pretext;
  if (yab_shop_config('checkout_section_name') == $pretext['s']) {
    $prefs['send_lastmod'] = false;
  }
}

If it works, it should perhaps be added to the distributed plugin code.

Offline

#869 2017-07-29 07:39:39

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 446
Website

Re: yab_shop (simple textpattern shop with paypal support)

ruud wrote #306478:

Edit the plugin, at the top, add this at the top:

register_callback('pretext_end', 'yab_shop_modified');...

Something like that. Not tested. If it works, it should perhaps be added to the distributed plugin code.

Thank you very much, Ruud. I just tested this code by pasting it to the top of yab_shop_core. Unfortunately, when I turned the ‘Last-Modified’ header back on, the cart stopped displaying new additions. So this doesn’t work.

I wish I had studied php. I am afraid that except for discovering this issue, and testing and reporting, I am not of much help.

Last edited by Kjeld (2017-07-29 07:40:17)


Old Photos of Japan – Japan in the 1850s~1960s (100% txp)
MeijiShowa – Stock photos of Japan in the 1850s~1960s (100% txp)
JapaneseStreets.com – Japanese street fashion (mostly txp)

Offline

#870 2017-07-29 07:54:24

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: yab_shop (simple textpattern shop with paypal support)

If you send me a username/password, I’ll have a look.

Offline

#871 2017-07-29 08:26:23

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 446
Website

Re: yab_shop (simple textpattern shop with paypal support)

ruud wrote #306480:

If you send me a username/password, I’ll have a look.

Oh, that is extremely generous of you, Ruud. Thank you. Will send it right away.


Old Photos of Japan – Japan in the 1850s~1960s (100% txp)
MeijiShowa – Stock photos of Japan in the 1850s~1960s (100% txp)
JapaneseStreets.com – Japanese street fashion (mostly txp)

Offline

#872 2017-07-29 09:59:41

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: yab_shop (simple textpattern shop with paypal support)

Code in my earlier post is corrected now. Let us know if it works.

Offline

#873 2017-07-29 10:53:56

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 446
Website

Re: yab_shop (simple textpattern shop with paypal support)

ruud wrote #306482:

Code in my earlier post is corrected now. Let us know if it works.

I just finished testing the new code in Safari and Chrome, and it works perfectly. I encounter no problems. Hopefully, this additional code can soon be added to the actual plugin by Trenc so other yab_shop users can benefit from it even when not aware of this exchange here.

Thank you very much, Ruud. I appreciate it immensely!


Old Photos of Japan – Japan in the 1850s~1960s (100% txp)
MeijiShowa – Stock photos of Japan in the 1850s~1960s (100% txp)
JapaneseStreets.com – Japanese street fashion (mostly txp)

Offline

#874 2017-10-27 10:16:50

trenc
Plugin Author
From: Amsterdam
Registered: 2008-02-27
Posts: 571
Website GitHub

Re: yab_shop (simple textpattern shop with paypal support)

Thanks for your input.

But unfortunately this would disable the last modified headers only on the checkout section. If someone runs a shop across different sections and is using the small cart widget, he/she has to disable the last modified header prefs either way.

I’m afraid this would be more confusing. Or I am wrong here?

But since this seems to be a topic maybe we should disable this pref for all yab_shop related sites in core by default?

Last edited by trenc (2017-10-27 10:19:41)

Offline

#875 2017-10-27 12:12:02

Kjeld
Member
From: Tokyo, Japan
Registered: 2005-02-05
Posts: 446
Website

Re: yab_shop (simple textpattern shop with paypal support)

trenc wrote #307548:

But since this seems to be a topic maybe we should disable this pref for all yab_shop related sites in core by default?

I’ll happily follow whatever you believe is best.


Old Photos of Japan – Japan in the 1850s~1960s (100% txp)
MeijiShowa – Stock photos of Japan in the 1850s~1960s (100% txp)
JapaneseStreets.com – Japanese street fashion (mostly txp)

Offline

#876 2017-11-10 07:10:07

sgreener
Member
Registered: 2008-11-05
Posts: 16

Re: yab_shop (simple textpattern shop with paypal support)

My website is Textpattern powered, though I am not a Textpattern guru: barely proficient I would say.

I am in the market for a shopping trolley application that can work from a database of products (no more than 10-20).

I note that out in the non-Textpattern world there are a lot of these sorts of applications.
I don’t know how easy it would be to integrate one of these with my website.
I have been considering porting my whole website to another CMS to get access to those shopping trolley applications.

Then I found this project, the only Textpattern one that seems to be working and operating.

Question is, is this project stable enough to warrant the effort to implement?
Are there any people who can help me with the implementation?

regards
Simon

Offline

Board footer

Powered by FluxBB