Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#616 2011-11-17 16:08:55
Re: yab_shop (simple textpattern shop with paypal support)
Men I just managed to get it right: just put the checkout tag within the shop_cart tag, like this:
<txp:yab_shop_cart>
<txp:yab_shop_checkout />
</txp:yab_shop_cart>
Cheers
Last edited by Manaus (2011-11-17 17:03:03)
Offline
#617 2011-11-19 14:43:54
- Saldacenkaw
- Member

- Registered: 2006-12-28
- Posts: 30
Re: yab_shop (simple textpattern shop with paypal support)
Hi! Why my page is reloading if I add a cart? Last-Modified header is off and I use Jquery 1.6.1 .
And this I see in testing mode
tag_error <txp:yab_shop_price /> -> Warning: number_format() expects parameter 1 to be double, string given on line 1559
thnx!
Last edited by Saldacenkaw (2011-11-20 12:54:48)
I know, my english is horrible
Offline
#618 2011-11-20 17:38:34
- adamgamb
- New Member
- Registered: 2011-11-20
- Posts: 3
Re: yab_shop (simple textpattern shop with paypal support)
I can’t see any way to actually link the “Terms of Use” button to a proper terms of use page??? i.e. currently it just links to http://demoshop.yablo.de/index.php?s=tou . Seems bizarre there is no option to set this in preferences, but I can turn it On/Off!
Offline
#619 2011-11-20 18:51:19
- Saldacenkaw
- Member

- Registered: 2006-12-28
- Posts: 30
Re: yab_shop (simple textpattern shop with paypal support)
adamgamb wrote:
I can’t see any way to actually link the “Terms of Use” button to a proper terms of use page??? i.e. currently it just links to http://demoshop.yablo.de/index.php?s=tou . Seems bizarre there is no option to set this in preferences, but I can turn it On/Off!
.yab-shop-required tou {display:none;} in css
I know, my english is horrible
Offline
#620 2011-11-21 10:20:04
Re: yab_shop (simple textpattern shop with paypal support)
Hi Saldacenkaw,
Hi! Why my page is reloading if I add a cart? Last-Modified header is off and I use Jquery 1.6.1 .
What do you mean with reloading?
If you add a product in your cart, then the page is reloaded? That’s normal, because adding a product is like sending a form (it’s not ajaxified). Or do you mean another issue?
tag_error <txp:yab_shop_price /> -> Warning: number_format() expects parameter 1 to be double, string given on line 1559
You must write prices in decimal. So if a product will costs €12, so write the price as 12,00 or 12.00, then it should work.
Digital nomad, sailing the world on a sailboat: 32fthome.com
Offline
#621 2011-11-21 10:24:45
Re: yab_shop (simple textpattern shop with paypal support)
Hi, adamgamb,
I can’t see any way to actually link the “Terms of Use” button to a proper terms of use page??? i.e. currently it just links to http://demoshop.yablo.de/index.php?s=tou . Seems bizarre there is no option to set this in preferences, but I can turn it On/Off!
You can find the text (and the link) for the TOU label in the »Yab_Shop L10n«. You have to look for »Checkout label for TOU«.
Digital nomad, sailing the world on a sailboat: 32fthome.com
Offline
#622 2011-11-21 11:30:04
Re: yab_shop (simple textpattern shop with paypal support)
Here’s a conundrum, and I think it relates to my problems with the name/address details not being passed to PayPal. They actually are, but PayPal only uses the info in some circumstances.
Currently, First & Last names, Street, City, Zip, E-mail and (optionally) State are designated required in the yab_shop checkout form. This is fine if you are offering purchase on account / on delivery / on prepayment, but of limited use with PayPal.
When you reach PayPal’s payment gateway page, you can choose to either:
- log in with your PayPal account. In this case your PayPal address details are used and the ones on the yab_shop checkout form are ignored.
- pay by debit/credit card. In this case the shipping address details from the yab_shop checkout form are used in the PayPal form. Any you do not supply are presented as input boxes for you to fill in before proceeding.
In the first case, having the fields as required inputs means you have (possibly) wasted someone’s time — ignoring the fact that the info is stored as a cookie to save you typing them in future. They do not need to enter shipping details.
In the 2nd case, PayPal will prompt for shipping details if they are not encoded in the button used to submit the cart contents, so it could be argued that it’s not necessary for them to be required on the shop site.
With this particular implementation I’m pursuing now I’ve allowed people to optionally create a Txp account at the checkout page. Any details they supply are stored in their bio. If they don’t put anything in they could fill it out later with a mem_self_register profile edit form. Even in this case, it may suit people to say that they want to create an account on our site, but they don’t want to fill their address in just yet.
So I’m leaning more towards making all the fields on the checkout form optional. This is reasonably easy in the code (just find the |r when it pertains to a field that is either displayed or read back in, and remove it; also removing the yab-shop-required class if necessary). The question is whether it’s the right thing to do for ALL transactions by hacking the code, or if the required fields should be user-definable from the yab_shop prefs page.
Anybody got any thoughts on this? Have I missed a use case where it is vital that the address details are required? For example, what happens if you try to buy on account and there’s no address data supplied? Perhaps the optional/required state could be set depending on the payment method? (although that creates a real headache when submitting the form as the field name is potentially different).
One possible avenue of exploration is the HTML5 required="required" attribute. If the inputs used that, it’s then down to the browser to enforce instead of yab_shop. The form processing in yab_shop is consequently simplified and the required/optional status of each field could be decided in the yab_shop prefs so it’s down to the application instead of the plugin to decide.
Any thoughts?
Last edited by Bloke (2011-11-21 11:30:34)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#623 2011-11-21 21:36:05
Re: yab_shop (simple textpattern shop with paypal support)
tag_error <txp:yab_shop_price /> -> Warning: number_format() expects parameter 1 to be double, string given on line 1559
trenc wrote:
You must write prices in decimal. So if a product will costs €12, so write the price as 12,00 or 12.00, then it should work.
Hi trenc.
While currently learning & configuring this plugin, I’m getting the same error, even if I write the price as 12,00 or 12.00.
Error message goes away if I set website’s production status to Live, but I’m not sure that would avoid any potential issue propagatin, as yab_shop internal code may still evaluate that the price is wrongly written.
…
… a little more time researching…
…
OK, it seems that the error goes away also if I apply this little mod to function yab_shop_currency_out:
function yab_shop_currency_out($currency, $what, $toform = '')
{
// MOD: make sure that the "string" is properly converted into a "double" (float) value
$toform = floatval($toform);
// END MOD
switch ($currency)
{
...
Trenc, as you seem to be confident that inputting the price using commas or dots should fix the issue, I’m not sure why that proposed solution didn’t work for me.
Also, I’m not sure at all if the mod I suggested above covers every possible place where this issue/error may pop up. And less sure if it opens or not another can of worms :)
So, a comment by you on this will really help to achieve some peace of mind :)
Tanks.
Offline
#624 2011-11-21 22:15:26
Re: yab_shop (simple textpattern shop with paypal support)
maniqui
If it’s any consolation I applied this very similar mod to my copy today, in exactly the same place you did:
$toform = (double)$toform;
The net effect is the same — casting the value to a double, or converting the value to a float using floatval().
I haven’t tested my version yet but I’m pretty sure it works and I would guess (might be wrong: this is PHP after all!) that casting is a nano quicker because it doesn’t involve a function call opcode or the stack.
EDIT: incidentally I think the warning also rears its head if the combined value of things in your cart works out to an exact integer value. Not sure, just a hunch. But either way the mod above covers it because everything calls that function prior to display.
Last edited by Bloke (2011-11-21 22:18:25)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
#625 2011-11-23 06:37:11
- Saldacenkaw
- Member

- Registered: 2006-12-28
- Posts: 30
Re: yab_shop (simple textpattern shop with paypal support)
maniqui, thnx! it’s works.
trenc, maybe ajaxified form is better? I like it, but I can’t develop it )
I know, my english is horrible
Offline
#626 2011-11-25 05:01:14
Re: yab_shop (simple textpattern shop with paypal support)
I’m slowly learning the ins & outs of this plugin, while trying to implement it on a client’s website.
Please, could anyone explain me what these different payment methods mean?
- Purchase on account
- Purchase on delivery
- Purchase against prepayment
In any case, I think client will be using just Paypal, but I’d really like to know what this other payment concepts really are.
Thanks.
Offline
#627 2011-12-04 17:35:33
- Saldacenkaw
- Member

- Registered: 2006-12-28
- Posts: 30
Re: yab_shop (simple textpattern shop with paypal support)
somebody now, how can do ajaxified form? I found this (http://forum.textpattern.com/viewtopic.php?pid=228580#p228580), but it not work correctly.
It’s work (thnx Jan!)
$(document).ready(function(){
$('article > form').submit(function(){
var thisForm = $(this);
var url = thisForm.attr('action');
var url = url.substr(0,url.indexOf('#'));
var data = thisForm.serialize()+'&add=1';
$.post(url, data, function(content){
$('#topz').html(content);
});
return false;
});
});
Last edited by Saldacenkaw (2011-12-14 12:00:58)
I know, my english is horrible
Offline
#628 2011-12-15 11:46:00
- hidalgo
- Member
- From: Australia
- Registered: 2008-02-05
- Posts: 86
Re: yab_shop (simple textpattern shop with paypal support)
It appears that there’s a problem with PayPal discarding product options (e.g. Size, Colour etc.) when a customer uses a mobile phone to pay for the order.
I’ve spent a good amount of time testing this today with a fresh TXP and yab_shop install, along with a PayPal sandbox account and think I’ve narrowed it down.
When PayPal detects that a customer is using a mobile phone, it automatically redirects the user to a ‘Mobile express checkout’ (cmd=_express-checkout-mobile) portal to process the payment and in the process discards the product options. The order email arrives with the product name and price, but is missing the product options.
Changing the browser User Agent to iPad or iPhone in Safari is enough to cause PayPal to redirect to the mobile portal which discards the product options. The exact same order using the default desktop User Agent arrives correctly as it always has.
I’ve looked through the PayPal developer documentation and PayPal preferences but can’t find anyway to disable the mobile redirect, or to stop the options from being discarded.
Is this happening to other sites using yab_shop? Maybe I’ve missing something obvious, or someone here has encountered this before and found a solution?
Update
It turns out that this is a current PayPal bug. Their response:
We are aware of this bug and are working towards a fix early in January. In the meantime you can add one of the unsupported parameters for mobile which should prevent the mobile view from being displayed. Please try to add the following to your script:
<INPUT TYPE="hidden" NAME="item_category" VALUE="Digital">
Last edited by hidalgo (2012-01-04 01:23:30)
Offline
#629 2011-12-20 11:06:13
- Saldacenkaw
- Member

- Registered: 2006-12-28
- Posts: 30
Re: yab_shop (simple textpattern shop with paypal support)
Hi! I posted js-source ajaxified form for yab_shop. But it have a trouble, POST go back all html-page. How make that POST return only cart-block?
I know, my english is horrible
Offline
#630 2011-12-30 22:01:39
- progre55
- Member
- Registered: 2006-05-02
- Posts: 668
Re: yab_shop (simple textpattern shop with paypal support)
Group:
I think I have a simple and straight forward question — don’t most start that way — how using this plug in can I reorganize the form so that the title and field are on the same line so that it condenses the length —
progre55
Offline