Skip to content

Commit

Permalink
Update PopulateCartTask.php (#824)
Browse files Browse the repository at this point in the history
Deprecated: replace Member::currentUser() with Security::getCurrentUser()
Update various docs
  • Loading branch information
AntonyThorpe authored May 2, 2024
1 parent f444899 commit 93c3fd3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/en/02_Customisation/01_Recipes/Custom_Checkout.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class MyCustomCheckoutComponentConfig extends CheckoutComponentConfig
{
parent::__construct($order);
$this->addComponent(CustomerDetailsCheckoutComponent::create());
if (Checkout::member_creation_enabled() && !Member::currentUserID()) {
if (Checkout::member_creation_enabled() && !Security::getCurrentUser()) {
$this->addComponent(MembershipCheckoutComponent::create());
}
if (count(GatewayInfo::getSupportedGateways()) > 1) {
Expand Down
2 changes: 1 addition & 1 deletion docs/en/02_Customisation/01_Recipes/Multi_Step_Checkout.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function getData(Order $order) {
return array(
'Organisation' => $order->Organisation,
...
if($member = Member::currentUser()){
if($member = Security::getCurrentUser()){
return array(
'Organisation' => $member->Organisation,
...
Expand Down
4 changes: 2 additions & 2 deletions src/Tasks/PopulateCartTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use SilverShop\Page\Product;
use SilverStripe\Control\Controller;
use SilverStripe\Dev\BuildTask;
use SilverStripe\Security\Member;
use SilverStripe\Security\Security;
use SilverStripe\Versioned\Versioned;

/**
Expand All @@ -30,7 +30,7 @@ public function run($request)
$product = $variations->sort('RAND()')->first();
}
$quantity = (int)rand(1, 5);
if ($product->canPurchase(Member::currentUser(), $quantity)) {
if ($product->canPurchase(Security::getCurrentUser(), $quantity)) {
$cart->add($product, $quantity);
}
}
Expand Down

0 comments on commit 93c3fd3

Please sign in to comment.