Can someone please help me with a code snippet to display the results for "store/history" in a block? I'm making a custom "cancelled payment" page for returns from PayPal, and I want to put some text + this table on the same page. This would be a great block to offer in future versions of Ecommerce. It's a great module, thanks to all the developers of it.

Comments

Dublin Drupaller’s picture

Assigned: Unassigned » Dublin Drupaller

Hi Carole,

Not sure if it's practical to fit the order history table in a block...you maybe better off just putting it in the main node area of the page. althogh you can use the snippet below in either situation...

.paste in the following snippet..edit it to suit...if you're setting up a block, set the visibility option so it only appears on your paypal return page......and remember to select the PHP Input filter before you submit the page/block.

global $user;
print '<div class="orderhistoryblock">';
print store_user_history($user->uid);
print '</div>';

You may need to set the page title after that..(I think the store_user_history function sets a "%username's order history" page title that might not be appropriate).

If that's the case, you can add in this to the snippet - after you call the store_user_history function.

$title2 = t('Paypal payment Cancelled'); 
drupal_set_title($title2);

hope that helps

dub

p.s. Incidentally, I've been playing around with the new in-development version of Drupal ecommerce for Drupal 6.x and it uses Views a lot, which makes it incredibly easy to create different types of views/blocks for ecommerce elements. It's not quite ready for a live production site (Gordon just release a beta), but, I thought I would mention it.

carole’s picture

Dub,
Thanks for your quick reply. I got this error when I tried it. Any suggestions?

Parse error: syntax error, unexpected T_STRING in /homepages/22/d188978797/htdocs/drupal57/includes/common.inc(1352) : eval()'d code on line 3

About the upgrade, I can't wait until D6 has enough modules & stability to become my preferred platform. I really struggled with it this fall on another site, checking every day for new alphas & betas I needed. Meanwhile, should I upgrade to EC3.5 on my D5 store? I am finally just about live on the D5.7/EC3.4 version, so if the upgrade is not seamless, I don't know how I can find the time for it.

Thanks a lot,
Carole

Dublin Drupaller’s picture

there was a typo in the snippet when I first posted it...I edited it just a moment ago, so perhaps you copied acorss the snippet with the typo. try it again, using the following:

global $user;
print '<div class="orderhistoryblock">';
print store_user_history($user->uid);
print '</div>';

I haven't looked at 3.5. I have live shops using 3.4 and they work great in Drupal 5.x. if you're almost there, I would tend to stick with what you have and go live with that. I'm guessing that 3.5 just has a few of the bug fixes and patches from 3.4 added...but, if you're almost finished, you've probably already applied those fixes anyway.

At least, that's the position I'm in with some shops I have live. i.e. they work brilliantly using EC 3.4 and I'm waiting til Drupal eCommerce 6.x-4.x comes out of beta before I upgrade.

That's just my 2.0 cents. hope it helps.

dub

carole’s picture

Dub, It works great - thanks so much.

I don't know if you have resolved the outstanding issues I'm still having? I can't get a shipping notice emailed out (attempting it gives me "Mail template for ec_mail_shipping_notification could not be found!"), and my taxes are not applying to provinces.

I posted them in an open EC3.3 thread on similar issues, http://drupal.org/node/162512#comment-1087796. If you have any solutions, they would be much appreciated.

Dublin Drupaller’s picture

you're welcome.

Shipping notices...I remember having the same problem. Can't remember off the top of my head who that was fixed. I'll have a quick look at the link you posted and see if I can recall how I fixed it.

re: taxes for provinces. I opted for using the flexicharge.module (or is it called ec_charge?) with the ec_regions.module (which allows you to specify a charge per country/province) instead of the tax module.

hope that helps. I'll have a look at that link you posted when I get a chance.

Phillip Mc’s picture

Status: Active » Closed (fixed)
provor’s picture

Status: Closed (fixed) » Active

Is their a way to display only specific fields in a order history block? Such as Total, ID, Workflow, Status?

gordon’s picture

Not really in v3.x as the reports are all hardcoded, and other than the labels it really can't be changed.

However in v4.x which is for Drupal 6.x all the these reports are created using views, so you will be able to completely lay out any of these reports anyway you like.

mayur.pimple’s picture

print format_interval(time() - $account->created);