Jump to content

Shop-for-ProcessWire (@Apeisa)


Nico Knoll

Recommended Posts

Hey,

will do some little work this week on the site profile.

I decided to switch the template from semi fluid to a static width.

I think for a basic profile it´s not necessary to use the fluid grid and it would make some things easier.

Next step will be the checkout process.

@ Apeisa: Found some issues in your module, there are many hardcoded english sentences in it, I think it would make it hard for unexperienced end-users to edit them. I think it would be helpful to let the user set them up in admin backend. Do you see a option to implement this feature?

@anybody interested: I´m using the great Ergo admin template for the backend. Is there a way to modify the home page of the admin to quick add a product?

Think it would enhance the usability if we provide some shop functions directly on the admin entry page, like adding a product, statistics, stuff like this.

Will do a post after uploading the next update.

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...
  • 1 month later...
  • 2 months later...

Sorry in advance for "abusing" this thread for my question:

I have something like this (very simplified) code to iterate through all products and output e.g. the price:

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

The output of products happens quite often on the website, so I wanted to source it out into a function, something like:

function productListing( $base ) {
    $str = "";
    foreach ( $base as $product ) {
        $str .= $modules->get( "ShoppingCart" )->renderPrice( $product->sc_price );
    }
    return $str;
}

and call it like this:

echo productListing( $page->children );

The problem with the function is that it doesn’t work. I get this error: Error:     Call to a member function get() on a non-object

So calling get() inside a function doesn’t work. Why?

Link to comment
Share on other sites

because of variable scope. The problem is not the get() method, but the variable $modules. You could pass it as a parameter of your functions, or use the equivalent  wire('modules') instead, since functions are not affected by scope:

$str .= wire('modules')->get( "ShoppingCart" )->renderPrice( $product->sc_price );
  • Like 1
Link to comment
Share on other sites

  • 5 months later...

First of all, great work from everyone who contributed to this module so far.

I'm totally new to ProcessWire but I instantly fell in love with the system...

Now I have two questions.

First:

@Luis: Is it correct that http://besser-landen.de/shop/ is from you and based upon the Shop-for-ProcessWire module?

If so, would it be possible to share the paypal checkout module and maybe even the whole template?

I saw you posted a template already but as far as I can tell it is not the same version you're now running...

Second:

@apaisa

I set up the webshop as you described it at https://github.com/apeisa/Shop-for-ProcessWire (in the ReadMe).

I recognized an odd behavior:

I can add products to the cart and if I go to the cart they are listed,

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

also gives me the right amount of different products added to the cart. But as soon as I proceed to the checkout page it gives me an error "Your shopping cart is empty." and the code posted above also returns 0.

Totally strange, isn't it? What could be the reason and how can I avoid it?

Link to comment
Share on other sites

Thank you Soma

It works perfect for me (and makes absolutely sense). This little tweak should definitely be integrated in the github- trunk.

It's such a great pleasure to see members in a support forum that really know what they are talking about. The last three years I've worked with joomla and it was horrible because 95% of all the answers from "experienced" admins where about clicking something and installing another module...

Thanks again!

  • Like 3
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...