Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#313 2009-06-03 09:45:23

trenc
Plugin Author
From: Malmö
Registered: 2008-02-27
Posts: 572
Website GitHub

Re: yab_shop (simple textpattern shop with paypal support)

Hi darkos,

I’ve set up an additional page with a tiny howto and a FAQ about yab_shop.

Offline

#314 2009-06-03 10:55:41

trenc
Plugin Author
From: Malmö
Registered: 2008-02-27
Posts: 572
Website GitHub

Re: yab_shop (simple textpattern shop with paypal support)

Hi Stef,

thanks for helping out with a short setting-up-explanation. :)

1) Is it possible to add a class attribute to the yab_shop_price field? I want to use some javascript like the one from your Nice House page for auto-updating the price field based on the variant chosen and its quantity. Your version specifically targets the ID of the price, which is fine but I’d like to use my own js in a form across all product pages. At the moment I’m using:

Yeah, think so. Could add a wraptag and a class attribute on <txp:yab_shop_price />.

2) Can I add the variant name in an arbitrary location within the product description in the cart and the checkout?
Widget <-> Widget (paper)
or something like that. Is it perhaps possible to use yab_shop_cart_items as a container so I can format the list using other yab_shop tags? Perhaps the same on the checkout page (although that’s less important because the variant is listed already underneath)? Maybe another tag <txp:yab_shop_cart_property name="material" /> could output the selected variant?

For flexibility it’s a nice idea. But I have to think about a little bit if an how this will work with all three product properties. But I think this could work — in one or another manner.

3) Can you see any clever way I could use promo codes per client? We have tiers of partners we work with: for example, we assign trusted partners whom we’ve known for ages or who always buy in bulk a “gold” promo code, others get “silver” and a few get “bronze”. Some we might even have special, dedicated promo codes for.
We set up the client logins manually and configure their initial details like company name, street address, email, what promotion level they receive, and so on. When a client logs in (ign_password_protect governs the login system) I’ll read their promo code from the database and would like to set — perhaps via a txp:variable — their promo code/discount and then automatically apply that code to their purchases.
At the moment the promos are hard-coded in yab_shop_config. My initial stab at making them dynamic might be, e.g:
[..]
Do you see any issue with doing this? Would it work? Can I automatically apply this code without them having to type it into a box on the screen? Do you have any better ideas on how to achieve this?

Hm, I have something in mind that should/could work. Hope you can wait 2 or 3 days, I have to structure my thought and have to check some of my code.

4) I’d like to auto-fill in the boxes at the bottom of the checkout form with relevant client info. Sure, they’d be “remembered” second time round if the client ticks the box on their 1st order, but I’d like it in there first time as well. I would prefer to hide the ‘remember’ checkbox so the values are always read from the ign user table and can simply be edited. The clients will be able to update their own details (via mem_self_register’s Profile Edit feature) so their details might change from time to time.

The remember checkbox does only save the data in cookies, as you probably know. So without hacking the yab_shop core your issue could be easily solved: When a client logs in so call a function that create the cookies with the apropriate data from the ign-db-tables.

Some pseudo code, ‘cause I don’t know the ign code and ign db-table names:

function smd_prefilled_client_fields()
{
	global $ign_data;

	// destroy existent cookies, 'cause we don't know whether client data has changed
	yab_shop_destroyCookies();

	// create new cookie with data from the ign db-table
	yab_shop_setCookies($ign_data[first_name], $ign_data[last_name], $ign_data[street], $ign_data[zip], $ign_data[city], $ign_data[state], $ign_data[phone], $ign_data[email]);
}

You will find the function yab_shop_setCookies() on line 2681 in the commended source code (for the order of the strings).

I think, this should do the thingy.

Oh, this would be the first quasi API usage. :)

Last edited by trenc (2009-06-03 11:01:29)

Offline

#315 2009-06-03 13:04:57

trenc
Plugin Author
From: Malmö
Registered: 2008-02-27
Posts: 572
Website GitHub

Re: yab_shop (simple textpattern shop with paypal support)

Stef, could you test this and report whether and how it works?

# Name: yab_special_promo v0.1 
# Type: Client side plugin
# Client Specific Promocode Support (IGN-DATA)
# Author: Tommy Schmucker
# URL: http://www.yablo.de/
# Recommended load order: 5

# .....................................................................
# This is a plugin for Textpattern - http://textpattern.com/
# To install: textpattern > admin > plugins
# Paste the following text into the 'Install plugin' box:
# .....................................................................

YToxMzp7czo0OiJuYW1lIjtzOjE3OiJ5YWJfc3BlY2lhbF9wcm9tbyI7czo3OiJ2ZXJzaW9u
IjtzOjM6IjAuMSI7czo4OiJyZXZpc2lvbiI7czowOiIiO3M6NjoiYXV0aG9yIjtzOjE1OiJU
b21teSBTY2htdWNrZXIiO3M6MTA6ImF1dGhvcl91cmkiO3M6MjA6Imh0dHA6Ly93d3cueWFi
bG8uZGUvIjtzOjExOiJkZXN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ZiAoJGl0ZW1b
J3Byb21vY29kZSddID09IDApCgkJewoJCQkkY2FydC0+ZWRpdF9wcm9tb2NvZGVzKCRpdGVt
WydpdGVtaWQnXSwgMSk7CgkJCSRjYXJ0LT5lZGl0X3Byb21vX3ByaWNlcygkaXRlbVsnaXRl
bWlkJ10sIHlhYl9uZXdfcHJvbW9fcHJpY2VzKCRpdGVtWydwcmljZSddKSk7CgkJfQoJfQp9
CgpmdW5jdGlvbiB5YWJfbmV3X3Byb21vX3ByaWNlcygkcHJpY2UgPSBmYWxzZSkKewoJZ2xv
YmFsICRpZ25fZGF0YTsKCSRwcm9tb19kaXNjb3VudCA9ICRpZ25fZGF0YVsnY2xpZW50X2Rp
c2NvdW50J107IC8vIENsaWVudCBkaXNjb3VudCBpbiBwZXJjZW50CgoJJHByaWNlX3RtcAk9
ICRwcmljZSAqICRwcm9tb19kaXNjb3VudCAvIDEwMDsKCSRwcmljZQkJCT0gJHByaWNlIC0g
JHByaWNlX3RtcDsKCXJldHVybiAkcHJpY2U7Cn0iO3M6MzoibWQ1IjtzOjMyOiIxMWZkMjgy
MzhiMzM0ZGFhMjJlYzM1YzA0M2M3MGVhNiI7fQ==

Last edited by trenc (2009-06-03 13:05:19)

Offline

#316 2009-06-03 15:00:13

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,276
Website GitHub

Re: yab_shop (simple textpattern shop with paypal support)

trenc

Thanks for the set-up guide and FAQ. Very useful.

Could add a wraptag and a class attribute on <txp:yab_shop_price />.

Brilliant, thanks. And thanks for considering my other random request about displaying the properties. Looking forward to what you come up with.

When a client logs in so call a function that create the cookies with the apropriate data from the ign-db-tables.

Aha! That makes sense. I’ll try that, thanks for the pointers.

I do think I jumped the gun a bit. I thought (could have sworn I read) somewhere that ign_pw_protect could be extended to store its own columns in its ign_user table. Thus I’d hoped to be able to add a few fields like street, promo discount, etc. But I can’t find any info on how to do this, so I’m writing a client-side admin screen that allows me to configure a new client. It stores all the data in smd_vars (remember that? Going to revisit it one day and make it work properly!)

could you test this and report whether and how it works?

Wow, great idea. Many thanks for the code.

Had a spot of bother getting it going. When you say “Place <txp:yab_special_promo /> after all <txp:yab_shop_cart /> in your pages” do you mean after every instance of <txp:yab_shop_cart /> or can I do it once at the end of the page/form?

I did edit the code, though, so I may have stuffed something up. Instead of using global $ign_data I changed it for $variable. What I have done is make a form called partner_promo that contains this:

<txp:smd_switch item='<txp:ign_user_info type="name" />'>

<txp:smd_case value="client1" />
<txp:smd_case value="client4" />
<txp:smd_case value="client5">
<txp:variable name="client_discount" value="10" />
<txp:variable name="client_discount_name" value="Premier" />
</txp:smd_case>

<txp:smd_case value="client2" />
<txp:smd_case value="client3">
<txp:variable name="client_discount" value="20" />
<txp:variable name="client_discount_name" value="Ultimate" />
</txp:smd_case>

</txp:smd_switch>

Using that I can apply one promo code to many clients by simply adding the client name to the Form. I might swap this info out to smd_vars as well at some point, this is just to test the concept.

So I then tried putting a call to <txp:yab_special_promo /> after each instance of <txp:yab_shop_cart />. Nothing happened. I checked the code and did some test output and found the yab_new_promo_prices() function was not being called. If I changed the function above to read if ($item['promocode'] == 1) then it works!

Except every time I refresh the checkout page it takes a further 10% off the price of all items… :-(

Is that because I’ve shafted something up or because I’ve put the special_promo on the checkout page after the <txp:yab_shop_cart output="none" />?

Many thanks for your work on this. If you want some more info off me just yell.

Last edited by Bloke (2009-06-03 15:13:05)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#317 2009-06-03 15:51:04

trenc
Plugin Author
From: Malmö
Registered: 2008-02-27
Posts: 572
Website GitHub

Re: yab_shop (simple textpattern shop with paypal support)

Hi Stef,

When you say “Place <txp:yab_special_promo /> after all <txp:yab_shop_cart /> in your pages” do you mean after every instance of <txp:yab_shop_cart /> or can I do it once at the end of the page/form?

I think a single placing in the section(s), where the products are added should be enough.

Except every time I refresh the checkout page it takes a further 10% off the price of all items… :-(
Is that because I’ve shafted something up or because I’ve put the special_promo on the checkout page after the <txp:yab_shop_cart output=“none” />?

No, this is because you set if ($item['promocode'] == 1), it must be 0.
If it 1, so yab_new_promo_prices() will called every page reload and minimizes the price. But I don’t understand why it’s not called when it’s 0. It should be the default value of the $item['promocode'].

Ah, maybe you have to delete the previous session cookie!? If you have tested it before with the build in promo code support, so maybe the session is still present with previous values, where $item['promocode'] is already set to 1.

Last edited by trenc (2009-06-03 15:57:54)

Offline

#318 2009-06-03 16:07:26

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,276
Website GitHub

Re: yab_shop (simple textpattern shop with paypal support)

trenc wrote:

I think a single placing in the section(s), where the products are added should be enough…. maybe you have to delete the previous session cookie!?

Yep, those two steps fixed it. Brilliant stuff, thanks man!

EDIT: when I log out of the ign_ session, is there a function I can call in yab_shop to delete the session cookie? Or do I use the usual PHP methods? If I log out and log back in as another user, the previous cart contents is still set.

Last edited by Bloke (2009-06-03 16:10:18)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#319 2009-06-03 16:55:50

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,276
Website GitHub

Re: yab_shop (simple textpattern shop with paypal support)

Oh, and by way of passing on a tip, if anyone wants to take action depending if the cart contains any items, the solution is fairly simple:

<txp:variable name="cartqty" value='<txp:yab_shop_cart_quantity output="all" break="" label="" />' />

<txp:if_variable name="cartqty" value="0">
  // Nothing in the cart
<txp:else />
  // Something in the cart
</txp:if_variable>

Last edited by Bloke (2009-06-03 16:56:13)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#320 2009-06-04 08:49:29

trenc
Plugin Author
From: Malmö
Registered: 2008-02-27
Posts: 572
Website GitHub

Re: yab_shop (simple textpattern shop with paypal support)

Bloke wrote:

EDIT: when I log out of the ign_ session, is there a function I can call in yab_shop to delete the session cookie? Or do I use the usual PHP methods? If I log out and log back in as another user, the previous cart contents is still set.

Hm, yes. This it’s a probem, ‘cause yab_shop works as non-login system and the session values are still available if an order will not be done (I know, it’s a real big issue on internet cafes and some multi-user terminals).

Normally the session will be depleted after a successful order. yab_shop do this with:

$cart->empty_cart();

So you can call this by an logout:

function smd_ign_clear_yab_shop_session()
{
	$cart =& $_SESSION['wfcart'];
	if (!is_object($cart))
	{
		$cart = new wfCart();
	}
	$cart->empty_cart();
}

But of course you can do this with a native PHP method. So it will be a a tabula rasa.

Offline

#321 2009-06-04 08:50:50

trenc
Plugin Author
From: Malmö
Registered: 2008-02-27
Posts: 572
Website GitHub

Re: yab_shop (simple textpattern shop with paypal support)

Bloke wrote:

Oh, and by way of passing on a tip, if anyone wants to take action depending if the cart contains any items, the solution is fairly simple:

<txp:variable name="cartqty" value='<txp:yab_shop_cart_quantity output="all" break="" label="" />' />

<txp:if_variable name="cartqty" value="0">
  // Nothing in the cart
<txp:else />
  // Something in the cart
</txp:if_variable>

Lol, nice. Thanks Stef. Never thought of that.

Offline

#322 2009-06-05 10:04:17

trenc
Plugin Author
From: Malmö
Registered: 2008-02-27
Posts: 572
Website GitHub

Re: yab_shop (simple textpattern shop with paypal support)

New version v0.7.1:

  • bugfix: forms and select elements in article listings now have an unique id for XHTML-validity and form has an anchor
  • bugfix: replaced array_flip() with another method in yab_shop_field_names() to prevend some warnings and errors
  • bugfix: removed hardcoded withespace and doublepoint from label in <txp:yab_shop_cart_subtotal /> and <txp:yab_shop_cart_quantity /> for a flexible output
  • new feature: <txp:yab_shop_checkout /> now have the optional attribute ‘summary’ for html table summary (accessability)
  • new feature: added the attributes ‘wraptag’ and ‘class’ for <txp:yab_shop_price />
  • new feature: added new tag <txp:yab_shop_show_config /> for returning config values

Stef, the <txp:yab_shop_cart_items /> as container seems not as easy as thought. :(
I ought to use some kind of a template, because the parsing of the container have to loop (per every items in cart). But I have no enlightening moment this time how to catch it.

Offline

#323 2009-06-05 15:34:18

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,276
Website GitHub

Re: yab_shop (simple textpattern shop with paypal support)

trenc

Brilliant stuff. And thanks for the tip about clearing the user data. I’ll do that on ign_logout() if I can.

No worries about the cart_items container. It was just a random idea. But related to my earlier question about the per-client percentages, do you think it would be possible for me to hack your per-client promo plugin to be able to detect which products are in the cart and apply different percentages per product? I was slightly mis-led (or I misunderstood, which is probably more likely!) and the situation is more complex than I thought:

  • Clients A and B might be on the Silver tier. This entitles them to 10% off Product1, 25% off Product2, 30% off Product3, 0% off Product4.
  • Client C might be on the Gold tier. This entitles them to 15% off Product1, 30% off Product2, 40% off Product3, 10% off Product4.
  • And so on…

If I could set up a similar system of $variables or smd_vars to hold this config data, is it possible to apply this kind of logic in the yab_special_promo() function? I don’t mind doing the heavy lifting in the code if you think it’s possible and could give me a few pointers about which variables I should be reading/altering?

Many thanks for your amazing support.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#324 2009-06-05 21:30:42

trenc
Plugin Author
From: Malmö
Registered: 2008-02-27
Posts: 572
Website GitHub

Re: yab_shop (simple textpattern shop with paypal support)

Ah ok. I’ve updated the little mockup:

# Name: yab_special_promo v0.2 (compressed)
# Type: Client side plugin
# Client Specific Promocode Support (IGN-DATA)
# Author: Tommy Schmucker
# URL: http://www.yablo.de/
# Recommended load order: 5

# .....................................................................
# This is a plugin for Textpattern - http://textpattern.com/
# To install: textpattern > admin > plugins
# Paste the following text into the 'Install plugin' box:
# .....................................................................

H4sIAAAAAAAAA+1V227jNhB9lr9iqgaRXcSWZDubjXwBsptgEaBIA3j3oVgEBi2NLCKUqIqU
vW6Qf++Qlpxs4/QL+iBpOHPmdkiOWBSOoicVjSO3YDm6ExWFF5G7Y6ulKjHmTCzLSubSGEi/
wUpxWZjVKHKDwdBIHyO3wg1vDUHkms+HyGW1zmRlY55H7leZ5ztYxFlex4+4VwctaFlX3Gi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G7xshA9h
QGezwVFLB1QfXnwJUKGuq6LRTTrPza3NE/szHg0jN1xdYHx5mSKGwXCFQXgZjC/GeBGMMQhG
mLiT538Awq8H4ugIAAA=

So now you can modify your form:

<txp:smd_switch item='<txp:ign_user_info type="name" />'>

<txp:smd_case value="client1" />
<txp:smd_case value="client4" />
<txp:smd_case value="client5">
<txp:variable name="client_discount" value='<txp:custom_field name="Premier_Discount" />' />
<txp:variable name="client_discount_name" value="Premier" />
</txp:smd_case>

<txp:smd_case value="client2" />
<txp:smd_case value="client3">
<txp:variable name="client_discount" value='<txp:custom_field name="Ultimate_Discount" />' />
<txp:variable name="client_discount_name" value="Ultimate" />
</txp:smd_case>

</txp:smd_switch>

<txp:yab_special_promo discount='<txp:variable name="client_discount"' />

This form you can place in your footer (in the sections, where a <txp:yab_shop_cart /> is placed too). The custom fields Premier_Discount and Ultimate_Discount you have to create, of course. So you can every single product/article assign with your tier-discounts (these should be float or integer) — hoping you have enough custom fields for your tiers.

But this will only work correctly (if it will work at all, I’ve doesn’t tested it) on individual articles. On article listings it will be a multi call of yab_special_promo.

Hope this is — roughly — what you have in mind.

Last edited by trenc (2009-06-05 21:38:12)

Offline

Board footer

Powered by FluxBB