We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Simple Commerce Module not showing purchases

Development and Programming

communicatedesign's avatar
communicatedesign
35 posts
16 years ago
communicatedesign's avatar communicatedesign

Hi there I have an implementation of the Simple Commerce Module at:

http://communicate.chemica.co.uk/clients/MKM/index.php/tradingpost/date_desc/

PLEASE NOTE this is a live account so don’t buy anything!

ExpressionEngine 1.6.4 - Build: 20080829

I’m using Mark Bowen’s shopping cart plug in to allow people to fill their cart on the site, rather than bouncing back and forwards to Paypal all the time. For purchases, it works fine - the cart is uploaded to Paypal and the transactions processed.

There is a problem however - nothing appears in the Simple Commerce module purchases list.

However, ppurchases made with buttons generated by the Commerce Module DO show up in the list of purchases. They generate code like this:

<form id='paypal_form_32_add_to_cart_button' method="post" action="https://www.paypal.com/cgi-bin/webscr"  >
<div class='hiddenFields'>
    <input type="hidden" name="cmd" value="_cart" />
    <input type="hidden" name="add" value="1" />
    <input type="hidden" name="business" value="[email protected]" />

    <input type="hidden" name="return" value="http://communicate.chemica.co.uk/clients/MKM/index.php/tradingpost/thankyou/" />
    <input type="hidden" name="cancel_return" value="http://communicate.chemica.co.uk/clients/MKM/index.php/tradingpost/cancelled/" />
    <input type="hidden" name="item_name" value="test item" />
    <input type="hidden" name="item_number" value="32" />
    <input type="hidden" name="quantity" value="1" />
    <input type="hidden" name="amount" value="0.01" />
    <input type="hidden" name="lc" value="US" />
    <input type="hidden" name="currency_code" value="GBP" />
    <input type="hidden" name="custom" value="1" />
    <input type="hidden" name="site_id" value="1" />
</div>

I put in code that generates the following:

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    <input type="hidden" name="cmd" value="_cart">
    <input type="hidden" name="upload" value="1">
    <input type="hidden" name="business" value="[email protected]">

    <input type="hidden" name="return" value="http://communicate.chemica.co.uk/clients/MKM/index.php/tradingpost/empty_and_thankyou/">
    <input type="hidden" name="cancel_return" value="http://communicate.chemica.co.uk/clients/MKM/index.php/tradingpost/cancelled/">
    <input type="hidden" name="lc" value="US">
    <input type="hidden" name="currency_code" value="GBP">

    <input type="hidden" name="custom" value="1">
    <input type="hidden" name="site_id" value="1">

    <input type="hidden" name="rm" value="2">
    <input type="hidden" name="cbt" value="Back to machineknittingmonthly.net">
    <input type="hidden" name="no_shipping" value="2">
    <input type="hidden" name="page_style" value="MKMredesign">
    <input type="hidden" name="notify_url" value="http://communicate.chemica.co.uk/clients/MKM/index.php?ACT=21">
        <table class="listings" border="0" cellspacing="0" cellpadding="0" summary="Trading Post" width="100%">

            <thead>
                <tr>
                    <th>Item</th>
                    <th>Price</th>
                </tr>
            </thead>
            <tbody>


                <tr class="odd">

                    <td class="item"><strong>test item</strong> <span class="cat-no">(t001)</span>
test</td>
                    <td class="price"><strong>1 at £0.01</strong>
<a href="http://communicate.chemica.co.uk/clients/MKM/index.php/tradingpost/remove/304/previous/" title="Remove test item from your cart" class="remove-from-cart">Delete item</a></td>
                    <input type="hidden" name="item_name_1" value="test item" />
                    <input type="hidden" name="quantity_1" value="1" />
                    <input type="hidden" name="amount_1" value="0.01" />
                    <input type="hidden" name="item_number_1" value="32" />

                </tr>


            </tbody>
            <tfoot>
                <tr>
                    <td><a href="http://communicate.chemica.co.uk/clients/MKM/index.php/tradingpost/empty_cart/" title="Empty cart">Empty cart</a> | <a href="http://communicate.chemica.co.uk/clients/MKM/index.php/tradingpost/" title="Continue Shopping">Continue Shopping</a></td>
                    <td class="price"><strong>Total - £0.01</strong></td>

                </tr>
                <tr>
                    <td></td>
                    <td class="price"><input type="submit" class="cart-checkout" value="Checkout"></input></td>
                </tr>
            </tfoot>
        </table>
</form>

All of the fields that look like they should be there are present, but nothing shows up. I’ve checked the IPN address and that’s fine, so I’m beginning to think that this may be a problem caused by how the Commerce module handles the data received from Paypal.

This makes me think that it’s not a problem with Mark’s plugin (and he’s looked at this problem a little already, and he also doesn’t think it’s not something that his code is doing).

Is there anything in the code for the Commerce Module that would be unable to interpret information received back from a cart upload, rather than a ‘buy now’ button? Sounds wierd I know but I’ve bashed my head against a brick wall for a day now and got nowhere.

Please, please help! I’m going mad and software engineering isn’t really my area, to be honest.

Thanks in advance (and sorry for the long post) Matt

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
16 years ago
Ingmar Greil's avatar Ingmar Greil

Are we talking about purchases by registered and logged-in members? Because while others still work fine (ie the sale goes through) they are not registered by the Simple Commerce Module.

       
communicatedesign's avatar
communicatedesign
35 posts
16 years ago
communicatedesign's avatar communicatedesign

Hi there Yes, I’ve been logged in all the time.

M.

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

Hi Matt,

Not too sure what is going on but just wanted to pop in to let people know what my plugin does so that might help so they know the whole sequence of events as it were.

Basically all my plugin does is handles storing the items that you wish to purchase and creates a shopping cart for that use. This just stops people from having to go back and forth adding items to a pop-up PayPal window every time.

The plugin allows you to spit out the items details such as title, price etc just as you would do normally with the Simple Commerce Module (SCM). In fact it works completely in conjunction with the SCM and weblog tags.

This allows you to create your own form to send off to wherever you like once all the items have been added to the cart.

So basically once a user has added all their items to the cart you can create a form which gets sent off to PayPal and after that it is all down to PayPal and the ping it sends back to the site.

Pretty sure in that respect that it isn’t going to be the plugin as that only handles storing the items up to the point when you create the form. After that it is all down to PayPal.

I personally can’t see anything un-toward in the code above but could be missing something. Matt I will take a look into this more tonight when I get home but hopefully someone will have an idea before then.

Best wishes,

Mark

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen
Hi there Yes, I’ve been logged in all the time. M.

And are you definitely logged in on the user side too? Perhaps you are visiting the site without www or for some reason you aren’t being seen as logged-in. Perhaps throw up a quick :

{if logged_in}
You are logged in!
{/if}

on the template with the items on just to check.

Best wishes,

Mark

       
communicatedesign's avatar
communicatedesign
35 posts
16 years ago
communicatedesign's avatar communicatedesign

Hi Mark I put that logged_in code in there and it does show me as logged in.

This is very puzzling, although it definitely helps to know that the Commerce Module won’t register purchases unless a user is registered and logged in.

I have a particular need to be able to send notifications to different people depending on which items have been purchased, so I’ll have to look into trying to make that happen with PayPal parameters, rather than the SCM, which is a pain, to be honest. Hopefully I can user a custom field on each item to populate a hidden field on the form submission with a related email address.

edited

Does the SCM purchase list get updated when the IPN comes back? And if so, how does it know that the transaction relates to a registered member?

–

Thanks for the input, guys. M.

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

Hi Matt,

Yes I think you could probably do what you need above with an extension which would activate when PayPal sends back its response to your server.

That’s something for the future though 😉

Would be really nice to find out what is causing your other problem though.

Best wishes,

Mark

       
Derek Jones's avatar
Derek Jones
7,561 posts
16 years ago
Derek Jones's avatar Derek Jones

Hi Matt, am I understanding you correctly that IPN works fine when you use the native tags and variables of the Simple Commerce module?

       
communicatedesign's avatar
communicatedesign
35 posts
16 years ago
communicatedesign's avatar communicatedesign
Hi Matt, am I understanding you correctly that IPN works fine when you use the native tags and variables of the Simple Commerce module?

Yes, that’s right. The purchases show up in the control panel.

I’ve tried every parameter combination that I think is possible, and it just doesn’t happen when I submit the transaction using the Cart Upload feature on PayPal.

I am fully prepared to admit that I may have missed something though - as I’ve said, I’m not a software engineer and I have been working on this for about 7 hours straight now, and I think anyone can go ‘code-blind’ after that length of time!

Matt

       
Ingmar Greil's avatar
Ingmar Greil
29,243 posts
16 years ago
Ingmar Greil's avatar Ingmar Greil

Matt, I am not familiar with the plugin you are using here. If it does work correctly with EE’s native tags, it looks like the issue lies with this plugin, and not the simple commerce module as such. Let me move this thread over to the appropriate “Plugin” forum for you.

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
16 years ago
Mark Bowen's avatar Mark Bowen

Hopefully it isn’t a problem with the plugin as from what I said before all the plugin does is allows you to store the items and then spit out all the information anywhere you need at a later date.

Should it not be possible in that respect to then create a form which uses the cart method to send the items off to PayPal and have PayPal send back all the details correctly?

If you were to hard-code a form and use the cart method would that work as all the plugin does is spits out entry_id’s prices, title etc by using the standard weblog and Simple Commerce Module tags.

Best wishes,

Mark

       
communicatedesign's avatar
communicatedesign
35 posts
16 years ago
communicatedesign's avatar communicatedesign

What confuses me is that all the SCM does - with or without the plugin - is generate HTML code.

When you use buttons in the SCM tags, like {add_to_cart_button}Add to Cart{/add_to_cart_button}, it generates a button with a bunch of hidden tags.

The module with the plugin also generates a button with HTML tags. The hidden fields look no different as far as I can tell - see my post further up the page for the code. The only extra ones I’m using are tags with information about shipping etc.

The only (meaningful) difference as far as I can see is this:

SCM native tag = cart=1;add=1 SCM with plugin = cart=1;upload=1

  • Which is why I can’t see how it’s a problem with the plugin. The above would lead me to think it was more likely something in the way the SCM handles the results that come back from Paypal.

But this really isn’t my field, so I can’t be sure…

M.

       
Derek Jones's avatar
Derek Jones
7,561 posts
16 years ago
Derek Jones's avatar Derek Jones

Where is your ‘item_number’ field?

       
communicatedesign's avatar
communicatedesign
35 posts
16 years ago
communicatedesign's avatar communicatedesign

Within the table listings:

<td class="item"><strong>test item</strong> <span class="cat-no">(t001)</span>
test</td>
                    <td class="price"><strong>1 at £0.01</strong>
<a href="http://communicate.chemica.co.uk/clients/MKM/index.php/tradingpost/remove/304/previous/" title="Remove test item from your cart" class="remove-from-cart">Delete item</a></td>
                    <input type="hidden" name="item_name_1" value="test item" />
                    <input type="hidden" name="quantity_1" value="1" />
                    <input type="hidden" name="amount_1" value="0.01" />
                    <input type="hidden" name="item_number_1" value="32" />
       
Derek Jones's avatar
Derek Jones
7,561 posts
16 years ago
Derek Jones's avatar Derek Jones

No, that is ‘item_number_1’, not ‘item_number’.

       
1 2 3

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.