Blog posts of '2014' 'July'

Prior to nopCommerce 3.40, "In-Store Pickup" was Shipping Method and the customer had to select or enter a shipping address just to be able to get to the Shipping Methods page (or tab in One-Page Checkout). "In-Store Pickup" has now moved to the Shipping Address page. You can enable this by checking the '"Pick Up in Store" enabled:' option on the Configuration > Settings > Shipping Settings page.

If you have several payment options including "Pay In Store", you may want to only show "Pay In Store" if the customer selected "In Store Pickup". Payment Director can handle this:

Order

Type

Name

Expression

Fee Expression

20

Option

Payments.PayInStore

ShippingOptionName = "In-Store Pickup"

Be sure to activate all the Payment Methods you want to offer, and then you only need to enter the one conditional Option above. Any Options not indicated in the Payment Director configuration page will always show unconditionaly.

If you have multiple languages, you can access the Locale Resource String for the In-Store Pickup Shipping Method Name. (This is also the shipping name you see on the Order). Use Payment Director's GetLocaleString method:

Order

Type

Name

Expression

Fee Expression

10

String

In-Store Pickup

GetLocaleString("Checkout.PickUpInStore.MethodName")

20

Option

Payments.PayInStore

ShippingOptionName = [In-Store Pickup]

Additionally, if you want to show a payment method, but have it disabled so that the customer can't select it, Payment Director includes replacements for the Checkout Views that allow you to do that. They also will let you show replacement text for the Friendly Name. For example, if you want to still show the "Pay In Store" option, but don't want to the customer to be able to select it, and also for the description, show "(Pay In Store available only for In-Store Pickup)" rather than just "Pay In Store", you can set up a localized resource string for the text, and set up a Condition in the Friendly Name Expression:

Order

Type

Name

Expression

Friendly Name Expression

10

String

In-Store Pickup

GetLocaleString("Checkout.PickUpInStore.MethodName")

20

String

In-Store Pickup Hint

GetLocaleString("Checkout.InStorePickupHint")

30

Boolean

In-Store Pickup Selected

ShippingOptionName = [In-Store Pickup]

20

Option

Payments.PayInStore

[In-Store Pickup Selected] ? Show : Disabled

[In-Store Pickup Selected] ? "" : [In-Store Pickup Hint]

You can download the above configuration that you can then import into Payment Director. You will find the replacement Views in the \Views subfolder in the download .zip file. (Read the Readme.txt file in the .zip file.)

Updates for 3.40Warnings about ShippingDirectorIsActive and OtherShippingRateMethodsAreActive Warning: Core 'Free shipping over X' is enabled Warning: Actual store shipping will be 0 because ... the cart has no items that require shipping all products are marked for 'Free shipping' the Customer role has free shipping"

Update 2017-12 - Although the HasAttribute extension still works, it won't be able to check the DiscountCouponCode as in the above example. nopCommerce now supports multiple coupon codes applied to the cart. So, they now store XML in the DiscountCouponCode attribute. Also, the attribute can be the null string, and you cannot call methods (like ToLower() ) on null strings. This is how you can create a variable:

Here's a bunch of expressions you can try. Be sure that you activate any Payment Method that you want to use.

Boolean $Debug true - this will log trace messages in the System > Log. Be sure to remove it (or make inactive) in production.

Check Or Money Order - shows custom localized text

Cash On Delivery - only visible if postal code starts with 888

Manual Credit Card - only visible when an admin is impersonating. Note the " use POS " hint added to the freindly name

Manual and Authorize.ney - calculate the fee based on selected card

Purchase Order - only visible for specific role

Pay In Store - visible always, but can only be selected if shipping method selected in In-Store Pickup

PayPal - only visible for store # 1 when selected shipping is FedEx

In order to utilize the features to have disabled payment methods, and to change the name of payment methods that the customer sees, replace your checkout views (.cshtml files) with the ones provided in the \Views\Checkout sub folder from the evaluation zip file you downloaded.

Type

Name

Expression

FeeExpression

FriendlyNameExpression

Boolean

$Debug

true

String

CheckOrMoneyLocalized

GetLocaleString("your.custom.text")

Option

Payments.CheckMoneyOrder

true

[CheckOrMoneyLocalized] + " (test)"

Option

Payments.CashOnDelivery

Customer.ShippingAddress.ZipPostalCode.StartsWith("888")UPDATE: you can use just Zip.StartsWith("888")

Also, if you're using the Test button in the PD configure page, if any expression uses OrderTotalWithoutPaymentFee, then be sure you've used the public store to put an item in the cart, and if using ShippingOptionName, go through the checkout process just past selecting a shipping method. (PD will warn you otherwise)