Jump to content

spoetnik

Members
  • Posts

    78
  • Joined

  • Last visited

Posts posted by spoetnik

  1. I am planning to make all render methods (the ones that output markup) hookable and also configurable. Although other way to look at it is that these modules should give you all the "low level" methods that make it simple to build your own cart.

    So current method here is to render the cart by yourself all together (in your template for example). So instead of this:

    <?= $modules->get("ShoppingCart")->renderCart() ?>
    

    You would do something like this:

    $cart = $modules->get("ShoppingCart");
    $items = $cart->getCurrentCart();
    foreach ($items as $item) {
      // get product price from actual product page
      $product	 = $pages->get($item->product_id);
      $total_price = $item->qty * $product->sc_price;
      $out .= "<td>{$product->title}</td>";
      $out .= "<td><input data-price='" . $product->sc_price . "' name='items[{$product->id}]' type='number' size='2' value='" . (int) $item->qty . "'/></td>";
    
      $out .= "<td>" . $cart->renderPrice($total_price) . "</td>";
      $out .= "<td><a class='remove' href='./?sc_remove=" . $product->id . "'>remove</a></td>";
     }
    echo $out;
    

    Well, look into renderCart() method in ShoppingCart module, it should give you best picture what to do there. But $items has all your items (page id and title), just iterate over them.

    Sweeeeeet!! I will play with this. Thanks for pointing me out in the right direction!!

  2. Maybe this is more of a general PW question, or even a general php question. How do I controll and modify the default output of modules?? I am trying to modify the default shoppingcart. I heart about hooks, but don't know if they are there, and if they are there, how to use them.

    Another thought would be to extend the shoppingCart class in my own module, but without success sofar.

    Could someone please help this novice in the right direction a bit??

    Thanks.

  3. Antti, I've been sacrificing forum time for PW development time, and just wanted to apologize I've not been able to actively participate in this more. But I wanted to let you know how impressed and interested I am in this. I already have all kinds of plans for using this and getting more involved, and am thinking it will be perfect to use for the DI bookstore. This is the coolest and biggest PW project to come along, and I just wanted to explain my lack of posts in here. The reason is that I'm about to jump into a work schedule (this week) where I'm not going to be able to do anything major with PW for 6 weeks, other than fix bugs and make 2.2 official. Though I'll be developing [a site] in it, rather than developing for it, so I guess that still counts as ProcessWire time. :) But I've been redirecting my forum time to put out a couple new PW features ahead of schedule (primarily repeatable fields), to hopefully buy some patience for the weeks ahead where I have to focus mostly on another project. But once that is done, I am looking forward to building a store and participating in the project.

    Thanks for all the hard work, and the release of PW 2.2. Are you still planning on participating in this project? I hope this will help this project gain momentum, as I think a project like this will help PW get noticed.

  4. This is the stacktrace of the error I get. I dont' understand what's wrong:

    [24-Feb-2012 16:29:13] PHP Warning:  Cannot modify header information - headers already sent by (output started at /DATA/www-root/proc.wainmanhawaii.nl/site-wainmanhawaii.nl/modules/Shop/ShoppingCart.module:2) in /DATA/www-root/proc.wainmanhawaii.nl/wire/core/Session.php on line 258
    [24-Feb-2012 16:29:13] PHP Stack trace:
    [24-Feb-2012 16:29:13] PHP   1. {main}() /DATA/www-root/proc.wainmanhawaii.nl/index.php:0
    [24-Feb-2012 16:29:13] PHP   2. ProcessWire->__construct() /DATA/www-root/proc.wainmanhawaii.nl/index.php:183
    [24-Feb-2012 16:29:13] PHP   3. ProcessWire->load() /DATA/www-root/proc.wainmanhawaii.nl/wire/core/ProcessWire.php:46
    [24-Feb-2012 16:29:13] PHP   4. Modules->triggerInit() /DATA/www-root/proc.wainmanhawaii.nl/wire/core/ProcessWire.php:134
    [24-Feb-2012 16:29:13] PHP   5. ShoppingCart->init() /DATA/www-root/proc.wainmanhawaii.nl/wire/core/Modules.php:126
    [24-Feb-2012 16:29:13] PHP   6. Session->redirect() /DATA/www-root/proc.wainmanhawaii.nl/site-wainmanhawaii.nl/modules/Shop/ShoppingCart.module:35
    [24-Feb-2012 16:29:13] PHP   7. Wire->__call() /DATA/www-root/proc.wainmanhawaii.nl/site-wainmanhawaii.nl/modules/Shop/ShoppingCart.module:35
    [24-Feb-2012 16:29:13] PHP   8. Wire->runHooks() /DATA/www-root/proc.wainmanhawaii.nl/wire/core/Wire.php:229
    [24-Feb-2012 16:29:13] PHP   9. call_user_func_array() /DATA/www-root/proc.wainmanhawaii.nl/wire/core/Wire.php:269
    [24-Feb-2012 16:29:13] PHP  10. Session->___redirect() /DATA/www-root/proc.wainmanhawaii.nl/wire/core/Wire.php:269
    [24-Feb-2012 16:29:13] PHP  11. header() /DATA/www-root/proc.wainmanhawaii.nl/wire/core/Session.php:258
    [24-Feb-2012 16:29:13] PHP Warning:  Cannot modify header information - headers already sent by (output started at /DATA/www-root/proc.wainmanhawaii.nl/site-wainmanhawaii.nl/modules/Shop/ShoppingCart.module:2) in /DATA/www-root/proc.wainmanhawaii.nl/wire/core/Session.php on line 259
    [24-Feb-2012 16:29:13] PHP Stack trace:
    [24-Feb-2012 16:29:13] PHP   1. {main}() /DATA/www-root/proc.wainmanhawaii.nl/index.php:0
    [24-Feb-2012 16:29:13] PHP   2. ProcessWire->__construct() /DATA/www-root/proc.wainmanhawaii.nl/index.php:183
    [24-Feb-2012 16:29:13] PHP   3. ProcessWire->load() /DATA/www-root/proc.wainmanhawaii.nl/wire/core/ProcessWire.php:46
    [24-Feb-2012 16:29:13] PHP   4. Modules->triggerInit() /DATA/www-root/proc.wainmanhawaii.nl/wire/core/ProcessWire.php:134
    [24-Feb-2012 16:29:13] PHP   5. ShoppingCart->init() /DATA/www-root/proc.wainmanhawaii.nl/wire/core/Modules.php:126
    [24-Feb-2012 16:29:13] PHP   6. Session->redirect() /DATA/www-root/proc.wainmanhawaii.nl/site-wainmanhawaii.nl/modules/Shop/ShoppingCart.module:35
    [24-Feb-2012 16:29:13] PHP   7. Wire->__call() /DATA/www-root/proc.wainmanhawaii.nl/site-wainmanhawaii.nl/modules/Shop/ShoppingCart.module:35
    [24-Feb-2012 16:29:13] PHP   8. Wire->runHooks() /DATA/www-root/proc.wainmanhawaii.nl/wire/core/Wire.php:229
    [24-Feb-2012 16:29:13] PHP   9. call_user_func_array() /DATA/www-root/proc.wainmanhawaii.nl/wire/core/Wire.php:269
    [24-Feb-2012 16:29:13] PHP  10. Session->___redirect() /DATA/www-root/proc.wainmanhawaii.nl/wire/core/Wire.php:269
    [24-Feb-2012 16:29:13] PHP  11. header() /DATA/www-root/proc.wainmanhawaii.nl/wire/core/Session.php:259
    [24-Feb-2012 16:29:13] PHP Warning:  Cannot modify header information - headers already sent by (output started at /DATA/www-root/proc.wainmanhawaii.nl/site-wainmanhawaii.nl/modules/Shop/ShoppingCart.module:2) in /DATA/www-root/proc.wainmanhawaii.nl/wire/core/Session.php on line 260
    [24-Feb-2012 16:29:13] PHP Stack trace:
    [24-Feb-2012 16:29:13] PHP   1. {main}() /DATA/www-root/proc.wainmanhawaii.nl/index.php:0
    [24-Feb-2012 16:29:13] PHP   2. ProcessWire->__construct() /DATA/www-root/proc.wainmanhawaii.nl/index.php:183
    [24-Feb-2012 16:29:13] PHP   3. ProcessWire->load() /DATA/www-root/proc.wainmanhawaii.nl/wire/core/ProcessWire.php:46
    [24-Feb-2012 16:29:13] PHP   4. Modules->triggerInit() /DATA/www-root/proc.wainmanhawaii.nl/wire/core/ProcessWire.php:134
    [24-Feb-2012 16:29:13] PHP   5. ShoppingCart->init() /DATA/www-root/proc.wainmanhawaii.nl/wire/core/Modules.php:126
    [24-Feb-2012 16:29:13] PHP   6. Session->redirect() /DATA/www-root/proc.wainmanhawaii.nl/site-wainmanhawaii.nl/modules/Shop/ShoppingCart.module:35
    [24-Feb-2012 16:29:13] PHP   7. Wire->__call() /DATA/www-root/proc.wainmanhawaii.nl/site-wainmanhawaii.nl/modules/Shop/ShoppingCart.module:35
    [24-Feb-2012 16:29:13] PHP   8. Wire->runHooks() /DATA/www-root/proc.wainmanhawaii.nl/wire/core/Wire.php:229
    [24-Feb-2012 16:29:13] PHP   9. call_user_func_array() /DATA/www-root/proc.wainmanhawaii.nl/wire/core/Wire.php:269
    [24-Feb-2012 16:29:13] PHP  10. Session->___redirect() /DATA/www-root/proc.wainmanhawaii.nl/wire/core/Wire.php:269
    [24-Feb-2012 16:29:13] PHP  11. header() /DATA/www-root/proc.wainmanhawaii.nl/wire/core/Session.php:260
    
    
  5. No other 3-th party modules installed. My code is probably horrable, I am not a skilled programmer, more a copy/past guy.

    It is just for testing, so not a big deal for me.

    @apeisa, If you are interested I could send you a backup of my site including a DB-dump, so you can test it? Again, it's nly for testing and fun for me, so no big deal at all.

  6. Installed the Commerce module in a MAMP Pro (mac) environment, and when adding an item to the cart I get an error message:

    Warning: Cannot modify header information - headers already sent by
    

    Line 35 of ShoppingCart.module

    Session->redirect( ) ../ShoppingCart.module:35
    

    Strange, because I had the same install (backed it up, restored it at home) on Ubuntu and everything was alright ?!?

    Any suggestions?

  7. It would be great if Processwire could handle a multi-site setup just like Drupal.

    At the moment the site structure is like:

    -site

    -wire

    A multi-site setup could be:

    -processwire.com

    -talk.processwire.com

    -any-other-site.com

    -wire

    Depending on the entry-domain, the config from the domain gets loaded. So http://processwire.com would load processwire.com/config.php and http://talk.processwire.com would load talk.proceswire.com/config.php.

    If you need a module for just one site, stick it in the domain/modules folder, same for the templates and assets.

    Any thoughts about this?

  8. Thanks Apeisa.

    I have been playing with your Shop-alpha module, and it looks promising.

    I have been thinking how I could solve the Product variations, and came up with this idea;

    Using Page reference.

    for instance a product called "I love PW T-shirt" with references to "I love PW T-shirt, black, small", "I love PW T-shirt, black large", "I love PW T-shirt, red, small", "I love PW T-shirt, red, large"

    The downside is it will be a hell of a job to add all product variations, but maybe a csv-import would ease the job.

    What do you think, is this the right track??

  9. Just installed Processwire on shared hosting using IIS on windows.

    Only problem I had was with the .htaccess file not doing the url rewrite. The hoster told me they use ISAPI_REWRITE 3 for IIS.

    Finally got it working by commenting out line 113 "RewriteCond %{REQUEST_URI} "^/~?[-_.a-zA-Z0-9/]*$"", and now it's all working fine.

    I don't understand the possible negative consequences by commenting out this line?

    • Like 2
×
×
  • Create New...