Jump to:

2082 Posts in 1002 Topics by 452 members

E-Commerce Modules

SilverStripe Forums » E-Commerce Modules » Working on e-commerce for SS 2.4

Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.

Moderators: martimiz, Nicolaas, Sean, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba, simon_w

Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Go to End
Author Topic: 12891 Views
  • biapar
    Avatar
    Forum Moderator
    435 Posts

    Re: Working on e-commerce for SS 2.4 Link to this post

    ok...thank you for clarification.

  • wainui
    Avatar
    Community Member
    56 Posts

    Re: Working on e-commerce for SS 2.4 Link to this post

    hi,

    just been testing the paypal payment with the latest version from google...
    seems pretty good and working but on return to shop after payment..
    I get an error

    [Notice] Object of class Money could not be converted to int

    Source
    Line 450 in /Users/mikemcvey/Sites/birds/ecommerce/code/model/Order.php

    441    /**
    442     * Checks to see if any payments have been made on this order
    443     * and if so, subracts the payment amount from the order
    444     * Precondition : The order is in DB
    445     */
    446    function TotalOutstanding(){
    447       $total = $this->Total();
    448       if($payments = $this->Payments()) {
    449          foreach($payments as $payment) {
    450             if($payment->Status == 'Success') $total -= $payment->Amount;
    451          }
    452       }
    453       return $total;
    454    }
    455    
    456    /**

    Any Ideas??

  • Jedateach
    Avatar
    Forum Moderator
    227 Posts

    Re: Working on e-commerce for SS 2.4 Link to this post

    Hi wainui, I fixed that in my 'burnbright' branch of the code. All that needs changing is:

    $payment->Amount becomes $payment->Amount->Amount

  • wainui
    Avatar
    Community Member
    56 Posts

    Re: Working on e-commerce for SS 2.4 Link to this post

    thank you very much
    how do I check out other branches like yours?

  • Jedateach
    Avatar
    Forum Moderator
    227 Posts
  • wainui
    Avatar
    Community Member
    56 Posts

    Re: Working on e-commerce for SS 2.4 Link to this post

    Hey jedaTeach..

    found a small error in the OrderInformation.ss include which make the payment data not display properly..

    <% control Payment %>


    Should be

    <% control Payments %>

  • mattconfusion
    Avatar
    Community Member
    48 Posts

    Re: Working on e-commerce for SS 2.4 Link to this post

    Hi jeda and hi guys,
    as we all know the ecommerce module creates if the database is empty a couple of example products and so on...
    i looked through the code and found how it's done. I need for testing purposes to create a test function that builds a number of products (ie 100, 1000, 100000) to test site tree stability. I did this, in my own extension of the Product class (myextendedproduct):

    function test () {
       
          parent::test();
          $group = new MyExtendedProductGroup();
             $group->Title = 'Example product group';
             $group->Content = '<p>This is a nested <em>product group</em> within the main <em>product group</em> page. You can add a paragraph here to describe what this product group is about, and what sort of products you can expect to find in it.</p>';
             $group->URLSegment = 'example-product-group';
             
             $group->writeToStage('Stage');
             $group->publish('Stage', 'Live');
       
          for ($i = 0; $i < 100; $i++){
       
             $page1 = new MyExtendedProduct();
             $page1->Title = 'Example product'.i;
             $page1->Content = $content . '<p>You may also notice that we have checked it as a featured product and it will be displayed on the main Products page.</p>';
             $page1->URLSegment = 'example-product'.i;
             $page1->ParentID = $group->ID;
             $page1->Price = '15.00';
             $page1->Weight = '0.50';
             $page1->Model = 'Joe Bloggs'.i;
             $page1->FeaturedProduct = true;
             $page1->writeToStage('Stage');
             $page1->publish('Stage', 'Live');
             DB::alteration_message('Product page \'Example product\' created', 'created');
             
             
          
          }
       
       
       }

    Anyway it's not working. Do i have to separate the product from the productgroup? and anyway, anyone tested large numbers in the site tree?

  • wainui
    Avatar
    Community Member
    56 Posts

    Re: Working on e-commerce for SS 2.4 Link to this post

    Also small error with check payment module and cheque payment.. which cause emails to have html code displayed.

    ie:

    class ChequePayment extends Payment {
       
       /**
        * Process the Cheque payment method
        */
       function processPayment($data, $form) {
          $this->Status = 'Pending';

    /* HTML entered here into payment message..... */

          $this->Message = '<p class="warningMessage">' . _t('ChequePayment.MESSAGE', 'Payment accepted via Cheque. Please note : products will not be shipped until payment has been received.') . '</p>';
          
          $this->write();
          return new Payment_Success();
       }

    class Payment extends DataObject {

       /**
        * Incomplete (default): Payment created but nothing confirmed as successful
        * Success: Payment successful
        * Failure: Payment failed during process
        * Pending: Payment awaiting receipt/bank transfer etc
        */
       public static $db = array(
          'Status' => "Enum('Incomplete,Success,Failure,Pending','Incomplete')",
          'Amount' => 'Money',

    // * EDIT - 'Message' => 'Text',
    /* Message should be HTMLText as feeding html warnings into it from ecommerce which are coming out as text in emails.. */

          'Message' => 'HTMLText',

          'IP' => 'Varchar',
          'ProxyIP' => 'Varchar',
          'PaidForID' => "Int",
          'PaidForClass' => 'Varchar',
          
          //This is used only when the payment is one of the recurring payments, when a scheduler is trying to
          //find which is the latest one for the recurring payments
          'PaymentDate' => "Date",
          
          //Usered for store any Exception during this payment Process.
          'ExceptionError' => 'Text'
       );

    Not sure which should be fixed... the payment or the cheque?

    12891 Views
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.