silvershop / silvershop-shipping Goto Github PK
View Code? Open in Web Editor NEWOptional shipping methods for the silverstripe shop module.
Optional shipping methods for the silverstripe shop module.
Consider the following use-case:
In the above case, the shipping modifier could be applied to an order before a user-address is present. It could even show the actual shipping cost inside the cart, at a time where the user-address might be unknown.
My proposal would be to implement a requiresAddress
method for each ShippingMethod
implementation. ZonedShipping and DistanceShipping would obivously simply return true
, but TableShipping could return either true or false.
Should I try to implement this change?
Brand new composer install and I get this error
I get this error
Cannot instantiate interface Geocoder\Geocoder in D:\wamp\www\mysite\shop_geocoding\code\AddressGeocoding.php on line 35
UPDATE:
If i use an older version of vendor/willdurand Geocoder it works.... hmmmm
It looks like he has done a major bit of work in the last wee while and maybe the name spaces are messed up?
https://github.com/geocoder-php/Geocoder
Have a great weekend.
:)
I was wondering if there is away to disable shipping on digital or virtual products
Fatal error: Call to a member function getShippingEstimates() on boolean in /home/xxxx/xxxx/silvershop-shipping/code/extensions/CheckoutStep_ShippingMethod.php on line 29
it happens when im at the shipping method stage cancelling the product from side cart. Page reloads and errors is up
If only one shipping option available for the cart, eg if there is a table rate shipping defined by value, can that be automatically applied. Seems like from a user pov the shippingmethod step is unnecessary.
There are some constants being defined in _config.php
that rely on constants from the core module. We should remove those, because it relies on the fact that the _config.php
file from the core module gets loaded first. Not sure where/why these constants are being used anyway.
It seems we have some weird issues with upgrading from
Object::add_extension("ComponentSet","OrderItemList"); to
Object::add_extension("DataList","OrderItemList"); this should be HasManyList I think but had issues
the problem is in ShippingEstimator when we call
function getEstimates(){
if($this->calculated){
return $this->estimates;
}
$output = new ArrayList(); // Had to use ArrayList because you can't add CalculatedRate to a DataList ??????
if($options = $this->getShippingMethods()){
foreach($options as $option){
$option->CalculatedRate = $option->calculateRate($this->package, $this->address);
if($option->CalculatedRate !== null){
$output->add($option);
}
}
}
$output->sort("CalculatedRate","ASC"); //sort by rate, lowest to highest
// cache estimates
$this->estimates = $output;
$this->calculated = true;
return $output;
}
What is strange is that when I am at the CheckoutStep_ShippingMethod it works and passes me the correct CalculatedRate but when I go to the payment step it returns null
in #61 @RVXD changed the value taken for calculating shipping costs to order's "Total" instead of SubTotal.
This introduces a bug when using TableShippingRates and stepped checkout.
Imagine a SubTotal of 75,-
Under 80,- we have a shipping fee of 10,-
Now the Total is 85,- and saved to the order object.
In the next step it calculates the shipping fee again, but now it uses the saved Total of 85,- to calculate it. Unfortunately this is just above free shipping limit.
The user sees a total calculated ammount of 75,- (Subtotal and no shipping), but internally the order is still worth 85,- .
Now the problems are really starting: The customer is sent to the payment gateway to pay the last calculated amount of 75,-, the order is not fully paid.
IMHO we should revert #61 and the discounts module should modify the value of "createShippingPackage" using the provided hook "updateShippingPackage"
After doing a 'PopulateShopTask' it creates a Category in the root called 'Shop'. If I try and view this page via mysite/shop it just returns
Forbidden
You don't have permission to access /shop/ on this server.
The other Categories and shop pages seem fine
Hi there,
I've set up SilverShop with the shipping, I can get an estimate calculated in the cart and I have the line "Shipping" appearing in the checkout subtotal calculation. So everything should be fine, though despite using the recommended settings in config.yml and removing the line if($checkoutsteps = CheckoutPage::config()->steps){SteppedCheckoutExtension::setupSteps($checkoutsteps);} in config.php, I still can't get the stepped checkout to work properly
This is the config.yml snippet used:
SilverShop\Model\Order:
modifiers:
- SilverShop\Shipping\ShippingFrameworkModifier
SilverShop\Page\CheckoutPage:
steps:
'membership': 'CheckoutStep_Membership'
'contactdetails': 'CheckoutStep_ContactDetails'
'shippingaddress': 'CheckoutStep_Address'
'billingaddress': 'CheckoutStep_Address'
'shippingmethod': 'CheckoutStep_ShippingMethod' #extra line for shipping method
'paymentmethod': 'CheckoutStep_PaymentMethod'
'summary': 'CheckoutStep_Summary'
I tried everything under the sun, so not sure if that's me not setting it up properly or else.
Regards,
Gaets for Digitweaks
Add Country and State models. Include pre-defined lists for popular countries
It might be worth finding or building a php equivalent to active_shipping: https://github.com/Shopify/active_shipping ...check packagist
Using APIs will require caching values, so too many calls aren't made = slow, and might exceed limits.
Hi There,
I'm on SS5.1 with SilverShop 4, PHP 8.1
When creating the first Shipping Method, there's an error making it impossible to save that first Shipping Method due to the getTitle()
[2024-03-25T02:15:44.637300+01:00] error-log.WARNING: E_DEPRECATED: number_format(): Passing null to parameter #1 ($num) of type float is deprecated {"code":8192,"message":"number_format(): Passing null to parameter #1 ($num) of type float is deprecated","file":"/home/******/store_dev/vendor/silvershop/shipping/src/Model/ShippingMethod.php","line":57} []
My workaround has been to set $rate as null then check if there's a $Rate set so at least we can create the Shipping Method then set the Rate and from there the error isn't reproduced.
public function getTitle()
{
$rate = null;
if($this->Rate != null){
$rate = number_format(
$this->Rate,
2,
ShopCurrency::config()->decimal_delimiter,
ShopCurrency::config()->thousand_delimiter
);
}
else $rate = 0;
if (ShopCurrency::config()->append_symbol) {
$rate = $rate . ' ' . ShopCurrency::config()->currency_symbol;
} else {
$rate = ShopCurrency::config()->currency_symbol . $rate;
}
$title = implode(" - ", array_filter([
$rate,
$this->Name,
$this->Description
]));
$this->extend('updateTitle', $title);
return $title;
}
Which branch should I use for SS 3.7 and Silvershop 2
I have an ajax call, the call uses following code to get $shipping object:
$method = ShippingMethod::get()->filter(array("ID" => $id))->first();
$order = ShoppingCart::curr();
$shipping = $method->getCalculator($order)->calculate();
above was working with old burnbright/shop module, since the old module was no longer supported,
I have changed to use silvershop/core.
Now there is a problem,
for ShippingCalculator class, to get address, it uses following line:
$this->order->ShippingAddress()
I think it should change to getShippingAddress.
In older version of Order class, ShippingAddress is correct way to fetch address,
Its added there, but never ran :)
hello
could you advise please!
im getting an error when trying to add a Warehouse
Fatal error: Class 'SilverStripe\Forms\GridField\GridField' not found in C:\wamp\www\myshop\hasonefield\code\HasOneButtonField.php on line 13
i have now SilverStripe 3.6
below is my info of what i got
"require": {
"php": ">=5.3.3",
"silverstripe/cms": "^3.1",
"silverstripe/framework": "^3.1",
"silverstripe/reports": "^3.1",
"silverstripe/siteconfig": "^3.1",
"silvershop/core": "^2.2",
"burnbright/omnipay-paystation": "~2.0",
"omnipay/paymentexpress": "~2.0",
"unclecheese/betterbuttons": "1.2.",
"silverstripe/googlesitemaps": "^1.5",
"silverstripe/userforms": "",
"silverstripe/blog": "2.@dev",
"silverstripe/comments": "^2.1",
"ezyang/htmlpurifier": "dev-master",
"thisisbd/silverstripe-maintenance-mode": "",
"heyday/silverstripe-menumanager": "~2.1.0",
"silvershop/shipping": "master"
},
Resulting in:
Fatal error: Call to undefined method OrderShippingExtension::error()
This occurs when there's no shipping address set, or createShippingPackage
returns null
.
I'm not sure how errors are triggered in other extensions, but maybe throw an exception instead?
This module's Composer dependencies include "burnbright/silverstripe-shop-geocoding": "~1.2,
. Even the most recent published version of this package, 1.2.3
, is almost 2 years old and has a dependency on the old "burnbright/silverstripe-shop": "*"
which causes a duplicate install of SilverStripe Shop.
The burnbright/silverstripe-shop-geocoding
repository has been updated to fix this but a new version has not yet been published.
Suggest changing this dependency to "burnbright/silverstripe-shop-geocoding": "dev-master"
until a new version of burnbright/silverstripe-shop-geocoding
is published.
I try to install the shipping module by composer. I use the commit of Oct 17, which should be for SilverStripe 3 / Silvershop 2. But composer gives this errors:
Brand new composer install and I get this error
I get this error
Cannot instantiate interface Geocoder\Geocoder in D:\wamp\www\mysite\shop_geocoding\code\AddressGeocoding.php on line 35
UPDATE:
If i use an older version of vendor/willdurand Geocoder it works.... hmmmm
It looks like he has done a major bit of work in the last wee while and maybe the name spaces are messed up?
https://github.com/geocoder-php/Geocoder
Have a great weekend.
:)
Shipping options currently display just "Price
- Title
- Description
", e.g. "10.00 - Standard Shipping - Description". To avoid any potential confusion, it should include a dollar sign in front of the price, e.g. "$10.00 - Standard Shipping - Description".
Hi there,
I am trying to require the updated version of the shipping module.
composer require silvershop/silvershop-shipping:master
I am having trouble requiring the module. Getting the following error when I run the command:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package silvershop/silvershop-shipping could not be found in any version, there may be a typo in the package name.
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.
Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
I can require via 'composer require silvershop/shipping'. However the version this installs is not up to date.
Best regards,
James
In the SilverShop\Shipping\Checkout\Component\ShippingCheckoutComponent::validateData() , ValidationResult::error() method is called which doesn't exist in SS4 anymore. This must be replaced with ValidationResult::addError()
I am using Silverstripe 5.1, silvershop 4.0, and silvershop-shipping 3.0 on PHP 8.1
After adding the table rate shipping and doing a test checkout, upon reaching the shipping method page. I am receiving this bunch of errors.
[Deprecated] Creation of dynamic property SilverShop\Shipping\ShippingPackage::$shape is deprecated
[Deprecated] Creation of dynamic property SilverShop\Shipping\ShippingPackage::$weightunit is deprecated
[Deprecated] Creation of dynamic property SilverShop\Shipping\ShippingPackage::$widthunit is deprecated
[Emergency] Uncaught InvalidArgumentException: Invalid sort column LENGTH("SilverShop_RegionRestriction"."PostalCode")
When I use table shipping and include the shipping estimator form and have shipping as one of my steps in check out I get this error.
No core has been touched and it was installed via composer.
``[Notice] Array to string conversion
POST /cart/ShippingEstimateForm/
98 // also include a special case where all constraints are empty
99 $emptyconstraint[] = "($mincol = 0 AND $maxcol = 0)";
100 }
101
102 $constraintfilters[] = "(" . implode(" AND ", $emptyconstraint) . ")";
103
104 $filter = "(" . implode(") AND (", [
105 ""ShippingMethodID" = " . $this->ID,
106 RegionRestriction::getAddressFilters(),
107 implode(" OR ", $constraintfilters) //metrics restriction
108 ]) . ")";
109
110 $tr = TableShippingRate::get()->where($filter)->sort("LENGTH("SilverShop_RegionRestriction"."PostalCode") DESC, "SilverShop_TableShippingRate"."Rate" ASC")->first();
111
112 if ($tr) {
113 $rate = $tr->Rate;``
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.