Jump to content
pwired

Apeisa Shop-for-processWire Module

Recommended Posts

Hello

I am trying to build a webshop with processwire.

I am setting up Apeisa's Shop-for-processwire Module.

Normally you have to setup a folder under /site/modules

and give the folder the same name as the module name.

However there are 8 files inside the zipfile with the extension .module

so which one to chose ? One of the files is ShoppingCart.module

so I guess that must be the one and use the word ShoppingCart

for the folder name that I have to put inside the modules folder.

But I better ask to be sure.

Also I want to ask if I can use this module just for banktransfers

and not for paypal.

Is there an example processwire template that uses the shoppingcart ?

Thanks.

Share this post


Link to post
Share on other sites

As far as I know the folder name doesn't matter.

And yes - just don't install the PayPalPayment module :)

Share this post


Link to post
Share on other sites

Thanks Nico.

I found 2 templates here

http://processwire.com/talk/topic/550-e-commerce-with-processwire/page-9#entry27094
http://processwire.com/talk/topic/550-e-commerce-with-processwire/page-9#entry27097
 

I am going through these threads to learn more.

http://processwire.com/talk/topic/550-e-commerce-with-processwire/

http://processwire.com/talk/topic/1732-shop-for-processwire-apeisa/

You guys can read and write code on the fly, I can't so I need some head start.

If anyone knows another template or a pw profile for Apeisa's shop just let me know.

Share this post


Link to post
Share on other sites

There's a readme in it with a step to step guide to install and run a Shop. You put all files in a folder for example "Shop" or "ShoppingCart"

Share this post


Link to post
Share on other sites

Thanks Soma, I just did that and used the word "ShoppingCart" as the name for the folder under site/modules/.

Also I just saw that the latest pw dev has an extra button in the backend for automatically find new modules.

That all worked well.

I checked the readme but the beginners problems I have is setting up calls in a shop template.

This is a template I found from Dave. Is this really all you need to run a shop ? Sorry for asking must read

silly but like I said just beginning with apeisa's module and a pw shop.

<?php

/**
* Page template
*
*/


include("./head.inc");
include("./navbar.inc");
?>

<div class="container">
<h1>Your Cart</h1>
<?php echo $modules->get("ShoppingCart")->renderCart(); ?>
</div>

<?php
include
("./foot.inc");

  • Like 1

Share this post


Link to post
Share on other sites

That would render the cart.

Share this post


Link to post
Share on other sites

Just looked back at that (abandoned) project.

The way I did it at the time was to have each product as a page (in an appropriate hierarchy), with fields like description, image and price, and show the add to cart button with

<?php echo $modules->get("ShoppingCart")->renderAddToCart(); ?>

As I recall, it all worked as expected.

<Edit>

Just tried it, and it still works.

Checkout page is quite like cart page  :rolleyes:

<?php

/**
 * Page template
 *
 */

include("./head.inc");
include("./navbar.inc");
?>
<div class="container">

<?php echo $modules->get("ShoppingStepsMarkup")->render(); ?>

<?php echo $modules->get("ShoppingCheckout")->renderCheckout(); ?>

</div>

<?php
include("./foot.inc");
Edited by DaveP

Share this post


Link to post
Share on other sites

Hope this is the right place to post this...

I've installed Shopping Cart and the Fixed Cost Shipping module, but renderCart() isn't outputting the code in the 'if ($shippingModule) {' block. The FixedCostShoppingModule isn't listed in the 'Modules Loaded' section of the debug tools either. I tried changing the references to the module name to 'ShippingFixedCostModule' but that didn't work.

I have been able to pull the shipping price into a template using:

$modules->get('ShoppingCart')->getTotalSumFromItems($items, $modules->get('ShippingFixedCost'))

So that makes it seem like it is loaded, but I'd like the shipping added when I call renderCart.

Share this post


Link to post
Share on other sites

Not on computer now, but if I reckon right, shipping is not shown at that phase at all, just before confirmation. But if you have fixed shipping price, why not just render mention about it under your cart?

Share this post


Link to post
Share on other sites

Aha. OK, if that's the way it's supposed to work, then I'll do that - I was just concerned that I'd made something go amiss behind the scenes.

Thanks for the swift reply Apeisa.

Share this post


Link to post
Share on other sites

There's two arguments to give renderCart()

If you only have one fixed shipping cost you could give it as the second argument, the first being true or false, viewonly or not editable cart.

https://github.com/apeisa/Shop-for-ProcessWire/blob/master/ShoppingCart.module#L193

echo $modules->ShoppingCart->renderCart(false, $modules->ShippingFixedCost);

The module isn't autoload, but loaded on demand.

Share this post


Link to post
Share on other sites

Brilliant! Thanks Soma, that makes life a lot easier.

Share this post


Link to post
Share on other sites

I'm now trying to add a country field to the checkout page. I've checked the 'Use Country field' and 'Is Country required' boxes on the Shopping Checkout module admin page, but they're not appearing in the rendered form.

I tried turning off the City fields as a test and this worked fine.

Share this post


Link to post
Share on other sites

Thanks Soma, that's the ShoppingOrdersManagement module which I will be needing, but my current problem is with the Checkout module. I don't think you've changed that in your version - does that mean it should be working as is?

Edit: Oh, just saw your edit.

Share this post


Link to post
Share on other sites

It should be working as I'm using it in various shops. Maybe you changed to add the country while you already testing, and the fields are saved in session.

Share this post


Link to post
Share on other sites

I need some help, how to get price value from custom template. Is price value getting back from protected methods or ?
If somebody have some example how to view price from sc_price field on custom page template?
Thanks

Share this post


Link to post
Share on other sites

Hi Danijel and welcome to PW. I haven't used the shop module yet, but I think what you are probably looking for is something like this:

$product->sc_price

So now of course you need to define $product.

From looking around I think this should work:

foreach ( $page->children as $product ) {
    echo $modules->get( "ShoppingCart" )->renderPrice( $product->sc_price );
}

Share this post


Link to post
Share on other sites

Adrian, thanks a lot! Its work , I looking for solution to native get custom fields values not through shopping cart module. If someone can explain me how to get values through API $fields.
Best regards, and good wishes to supports this good work in the future :)

Share this post


Link to post
Share on other sites

Danijel,

If I understand what you mean, then it's simply:

foreach ( $page->children as $product ) {
    echo $product->sc_price;
}

The renderPrice function included in the shop module (https://github.com/apeisa/Shop-for-ProcessWire/blob/e27eb462502feecca085db82d3183204b2925850/ShoppingCart.module#L278) is just there to format the price, it is not needed at all to get the price for the product.

Not sure how far along you are in your PW learning process, but the $page->children foreach is only relevant if you are on a page with multiple child pages as products. If you are on a single product child page already, then you might simply want this:

echo $page->sc_price;

Remember that $page refers to the current page being viewed, so in this case you are asking for the sc_price field for the current page.

Hope that helps.

Share this post


Link to post
Share on other sites

Is there an official topic? Can't seem to find it... :-)

I find a lot of others...

Seems I got an error

Error: 
Call to a member function getModuleInfo() on a non-object (line 229 of /processwire/site/modules/ShoppingCheckout.module) 

Grtz

Share this post


Link to post
Share on other sites

No there is no official topic, though there was one started long time ago but can't find. Also it's pretty much a "beta" WIP.

Anyway you may consider also adding an issue on github since there's an official repository.. https://github.com/apeisa/Shop-for-ProcessWire/issues?page=1&state=open

Looks like you have a problem with Payment module, have you any installed? The error does indicate there's not payment module.

Share this post


Link to post
Share on other sites

Thx for the answer...

I've added an issue on github.

I have a payment module installed: PaymentPaypal.module

since it's the only one I need [at the moment].

Weird thing: it doesn't show up all the time, just now and then, I've tried to trigger it but somehow I can't... and then suddenly 'boom' there it is... very weird

Share this post


Link to post
Share on other sites

The payment module is stored in session , so there might be an issue on your side. I use the shop in many projects and never had an issue with that.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...