Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2007-10-08 18:51:28
- adamreiswig
- New Member
- Registered: 2007-06-03
- Posts: 5
Write to Custom Fields Plugin?
Hello, while working on a store front with textpattern, I’ve come across the need to setup a quantity field as my customer’s store sells limited edition items. Is it possible via a plugin or otherwise to change data in an article’s custom field? I’d like to only have items display if qnty > 0. Thanks!
-Adam
Offline
#2 2007-10-08 21:16:26
- progre55
- Member
- Registered: 2006-05-02
- Posts: 668
Re: Write to Custom Fields Plugin?
Adam:
Check out:
I am not sure if this is what you are looking for, but it provides the greatest flexability when working with custom fields.
You could also combine it with code such as:
<txp:if_custom_field name=“quantity” val=“0”>
<txp:else />
</txp:if_custom_field>
progre55
Last edited by progre55 (2007-10-08 21:19:57)
Offline
#3 2007-10-08 21:30:57
- adamreiswig
- New Member
- Registered: 2007-06-03
- Posts: 5
Re: Write to Custom Fields Plugin?
so val=“0” changes the previous value to 0? If that’s the case that would work well for unique items where the original quantity was 1. But if it was 2 or more, is there a way to decrement the quantity value by the quantity purchased? Thanks for the note progre55.
Offline
Re: Write to Custom Fields Plugin?
No, <txp:if_custom_field name="quantity" val="0">
doesn’t change previous value to 0, it only output conditional data if custom-field’s value is 0. So it answers to your second question.
<txp:if_custom_field name="quantity" val="0">
<txp:else />
Quantity items if value is above zero
</txp:if_custom_field>
Cheers!
Offline
Re: Write to Custom Fields Plugin?
Are you looking for some kind of “automatic way” to change (decrease or increase) the value of a custom field? so when your client sells an item, and it’s the last one, the product gets removed from the page?
How do you suposse for TxP to know when an item was sold and so, decrease the quantity? ;)
I think the “automatic and easiest way” to do it is by manually editing the value in the custom field (teach your client how to do it).
Then, using an snippet as the one suggested above will do the work.
Offline
Re: Write to Custom Fields Plugin?
may be a good idea to keep an eye on textcommerce
its still in alpha stage but it allows you to control stock level like so:
Offline
#7 2007-10-08 22:35:54
- adamreiswig
- New Member
- Registered: 2007-06-03
- Posts: 5
Re: Write to Custom Fields Plugin?
Maniqui, yes that is what I was looking for. I recently purchased the book “Textpattern Solutions: PHP-Based Content Management Made Easy” since it reported to demonstrate how textpattern could be used as an e-commerce solution. My hope was that since it advocated using articles to represent items that there would be a mechanism for updating the custom fields. Primarily for quantity but I had thought of a couple other uses as well. I’m guessing that since the custom fields appear to be read only that I’ll end up creating a database that handles quantities and if items are still available or not.
The book suggests using wfCart (www.webforcecart.com) as the shopping cart but wfCart does not handle any item management. I think ideally I need to find or write a shopping cart solution that handles inventory management. If you know of something along these lines, I’d be very grateful to learn of them.
Thanks again,
Adam
Offline
#8 2007-10-08 22:37:54
- adamreiswig
- New Member
- Registered: 2007-06-03
- Posts: 5
Re: Write to Custom Fields Plugin?
Iblastoff, that looks good. I took a look at it the other day but didn’t consider using it as its still in Alpha. Unfortunately my current client is in a hurry to get up and running soon.
Offline
Offline
#10 2007-10-08 23:38:49
- adamreiswig
- New Member
- Registered: 2007-06-03
- Posts: 5
Re: Write to Custom Fields Plugin?
Gocom, good point. Sometimes the obvious escapes my attention. :)
I meant read only as in not changeable via <txt: > tags and elements. I was thinking in terms only modifying textpattern data tables via textpattern, but it certainly would fix my problem to simply use some php to do the job the old fashioned way.
Offline
Re: Write to Custom Fields Plugin?
yep definitely would not recommend using it live!
but yah a few mentions in the textpattern book i believe are somewhat misleading…the e-commerce section mentioned an e-shopping cart plugin for txp that is most likely never to actually see the day of light.
Offline
Pages: 1