Jump to content

Shop-for-ProcessWire (@Apeisa)


Nico Knoll

Recommended Posts

I guess the problem lies on database naming: ShoppingCart vs. shoppingcart

That actually was the problem apesia.Thanks a lot ! ..But what actually shocks me is how that worked on the local machine in the first place.The table names come from :

$update = $this->db->query("UPDATE {$this->className} SET items = '$items', total_sum = $total_sum WHERE session_id = '" . $this->getSession() . "'");
class ShoppingCart extends WireData implements Module, ConfigurableModule
Link to comment
Share on other sites

Delving deeper in the module code

CREATE TABLE {$this->className} (
			session_id VARCHAR(255) NULL,
			last_modified TIMESTAMP NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
			items TEXT NULL,
			total_sum FLOAT(10,2) NULL,
			user_id INT NULL,
			PRIMARY KEY (`session_id`) )
class ShoppingCart extends WireData implements Module, ConfigurableModule

it turns for that this code creates a table with name 'shoppingcart' instead of 'ShoppingCart' when run on my local wamp machine, but when run directly on my server xamp it creates 'ShoppingCart'.

And i got the problme because i ported from my local to server machine, so carried 'shoppingcart' table , which when called on local machine worked surprsiingly for some reason but on server its case-sensitive.

  • Like 1
Link to comment
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.

Link to comment
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.

Link to comment
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.

Link to comment
Share on other sites

  • 1 month later...

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

Link to comment
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 );
}
Link to comment
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 :)

Link to comment
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.

Link to comment
Share on other sites

  • 2 weeks later...

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

Link to comment
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.

Link to comment
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

Link to comment
Share on other sites

After all there's some quirks and stuff not coded very well. I have forked the shop module some time ago and fixed/changed minor things. I'm not sure what causing your error exactly, but seems as the session sometimes isn't set correct when the form wasn't valid or so.

You could try my version of the shop module, it's the dev version that has some changes there.

https://github.com/somatonic/Shop-for-ProcessWire/tree/dev

Although there's more changes and additions in this version, but should be compatible and not less unstable than the apeisa version.

  • Like 2
Link to comment
Share on other sites

Any videos to see the shop backend or payment options?

I think I have to install me a testing instance to see how it works...

Maybe I build a little shop with paypal and invoice payment options.

Looked at some shops build with that module before, but wouldn't order any products to see it work *g*

Link to comment
Share on other sites

  • 3 weeks later...

trying to create my first shop and finding the steps in the readme abit sparse.

was able to add a price / qty and rendered in a template but the $modules->get("ShoppingCart")->renderAddToCart(); doesnt seem to render anything. anyone had this issue?

Link to comment
Share on other sites

item template

include("./head.inc");

echo $page->body;
echo $page->sc_price . "\n";
echo $page->sc_qty . "\n";

$modules->get("ShoppingCart")->renderAddToCart();

$modules->get('ShoppingCart')->getNumberOfItems();
$modules->get("ShoppingCart")->renderCart();

include("./foot.inc");

Gives me the price and qty but nothing else

Link to comment
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...