Blog posts of '2014' 'July'

RSS
Payment Director - Pay In Store available only for In-Store Pickup- Wednesday, July 23, 2014

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.)

Tags :  PD-Restrict
Comments (1)
Shipping Director for nopCommerce 3.40 Released- Saturday, July 19, 2014

The SD version is 1.19

Release Notes

Updates for 3.40
Warnings 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"

Hide test button if SD is not active

Customer extension - HasAttribute  (This accesses the customer shopping attributes, not the customer custom attributes).  E.g.:
    Customer.HasAttribute("DiscountCouponCode","freeshipping")    //compare with InvariantCultureIgnoreCase

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:

   (Customer.GetAttribute("DiscountCouponCode") + ".").ToLower()

Or just test the condition directly:

   (Customer.GetAttribute("DiscountCouponCode") + ".").ToLower().Contains("""couponcode""")

Note the extra quotes "" on both sides of string.  The XML attribute is quoted.  In the future, we'll create a collection property to make this easier.

---end of update---

Tags :  ReleaseSD
Comments (1)
Payment Director - Various Expressions- Friday, July 18, 2014

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

  1. Boolean $Debug true  - this will log trace messages in the System > Log.  Be sure to remove it (or make inactive) in production.
  2. Check Or Money Order - shows custom localized text
  3. Cash On Delivery - only visible if postal code starts with 888
  4. Manual Credit Card - only visible when an admin is impersonating.  Note the " use POS " hint added to the friendly name
  5. Manual and Authorize.ney - calculate the fee based on selected card
  6. Purchase Order - only visible for specific role
  7. Pay In Store - visible always, but can only be selected if shipping method selected in In-Store Pickup
  8. 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")

 

 

Option

Payments.Manual

OriginalCustomerIfImpersonated != null

CreditCardType = null ? 0.00 : CreditCardType = "Visa" ? OrderTotalWithoutPaymentFee * 0.02 : 1.00

FriendlyName + " (use POS)"

Option

Payments.AuthorizeNet

OriginalCustomerIfImpersonated = null

CreditCardType = null ? 0.00 : CreditCardType = "Visa" ? OrderTotalWithoutPaymentFee * 0.02 : 1.00

FriendlyName + " (fee varies)"

Option

Payments.PurchaseOrder

Customer.IsInCustomerRole("Dealer Pricing")

 

 

Option

Payments.PayInStore

ShippingOptionName = "In-Store Pickup" ? Show : Disabled

 

ShippingOptionName = "In-Store Pickup" ? "" : FriendlyName + "(Available only for In-Store Pickup)"

Option

Payments.PayPalStandard

CurrentStoreId = 1 and ShippingOptionName.StartsWith("FedEx")

 

 

You can download the configuration import file by clicking on this link PaymentDirector (Various Expressions).txt

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)

Comments (1)