Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

E-Commerce Modules /

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, Ed, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba

Working on e-commerce for SS 2.4


Go to End


121 Posts   27698 Views

Avatar
biapar

Forum Moderator, 435 Posts

24 June 2010 at 7:23pm

ok...thank you for clarification.

Avatar
wainui

Community Member, 56 Posts

1 July 2010 at 7:25pm

Edited: 01/07/2010 7:25pm

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??

Avatar
Jedateach

Forum Moderator, 238 Posts

1 July 2010 at 7:27pm

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

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

Avatar
wainui

Community Member, 56 Posts

1 July 2010 at 10:27pm

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

Avatar
Jedateach

Forum Moderator, 238 Posts

2 July 2010 at 8:35am

Avatar
wainui

Community Member, 56 Posts

13 July 2010 at 5:17pm

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 %>

Avatar
mattconfusion

Community Member, 48 Posts

13 July 2010 at 7:28pm

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?

Avatar
wainui

Community Member, 56 Posts

13 July 2010 at 7:35pm

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?

Go to Top