简体   繁体   English

regexp drupal运输报价ubercart邮政编码

[英]regexp drupal shipping quotes ubercart postcodes

hopefully someone can help me. 希望有人可以帮助我。

I'm new to regexp... 我是regexp的新手...

I'm creating a commerce website for a local florists. 我正在为当地的花店创建一个商务网站。 They offer free postage within the local area (postcodes CM11 and CM12), and i'm looking to create fixed prices for further distances up to a 15 mile radius (they don't deliver outside 15 miles). 他们在当地提供免费邮资(邮政编码CM11和CM12),我正在寻找固定价格,以扩大半径不超过15英里的距离(他们不会在15英里以外运送)。

Shipping quote 1 运送报价1

  • I've created a 'free postage' shipping quote with the regexp condition that the postcode should be CM11 or CM12: 我创建了带有正则表达式条件的“免费邮费”运输报价,条件是邮政编码应为CM11或CM12:
  • cm1[1]|cm1[2] cm1 [1] | cm1 [2]
  • That works as expected and shows the free shipping if the postcode starts with CM11 or CM12. 如果邮编以CM11或CM12开头,那将按预期工作并显示免费送货。

Shipping quote 2 运送报价2

  • I've created a 'local delivery' shipping quote with the conditions below (this shows all the postcodes within a 15 mile radius) 我使用以下条件创建了“本地送货”运输报价(这显示了半径15英里内的所有邮政编码)
  • cm[1-5]|cm1[3-7]|cm99|ig[2-3]|ig[6-7]|me3|rm[1-9]|rm1[0-9]|rm20|ss0|ss1[1-7]|ss2|ss22|ss[4-9]|ss9[9] cm [1-5] | cm1 [3-7] | cm99 | ig [2-3] | ig [6-7] | me3 | rm [1-9] | rm1 [0-9] | rm20 | ss0 | ss1 [1-7] | ss2 | ss22 | ss [4-9] | ss9 [9]

The issue / question I have is how to hide the 'local delivery' option from appearing when the user enters a CM11 or CM12 postcode. 我遇到的问题是,当用户输入CM11或CM12邮政编码时,如何隐藏“本地递送”选项。 They should only see free delivery or collect in store (not the third option of local delivery) 他们只能看到免费送货或在商店取货(不是本地送货的第三种选择)

You can see on my site (if you add something the cart and follow the checkout process, experiment with the postcode and see the delivery options change) - http://techyhelp.uk/florist/catalog/5 您可以在我的网站上看到(如果您添加购物车中的东西并按照结帐流程操作,请尝试邮政编码,然后查看送货方式的更改) -http://techyhelp.uk/florist/catalog/5

在您的“本地投放”正则表达式中使用负前瞻来过滤出“ cm12”和“ cm11”:

^(?!cm1[12]$)(cm[1-5]|cm1[3-7]|cm99|ig[2-3]|ig[6-7]|me3|rm[1-9]|rm1[0-9]|rm20|ss0|ss1[1-7]|ss2|ss22|ss[4-9]|ss99)$

sweaver2112 - that worked perfectly thank you. sweaver2112-效果很好,谢谢。

So the answer to my question has been answered: 所以我的问题的答案已经回答:

use a negative lookahead in your "local delivery" regex to filter out "cm12" and "cm11": 在您的“本地投放”正则表达式中使用负前瞻来过滤出“ cm12”和“ cm11”:

^(?!cm1[12]$)(cm[1-5]|cm1[3-7]|cm99|ig[2-3]|ig[6-7]|me3|rm[1-9]|rm1[0-9]|rm20|ss0|ss1[1-7]|ss2|ss22|ss[4-9]|ss99)$ ^(?! cm1 [12] $)(cm [1-5] | cm1 [3-7] | cm99 | ig [2-3] | ig [6-7] | me3 | rm [1-9] | rm1 [0-9] | rm20 | ss0 | ss1 [1-7] | ss2 | ss22 | ss [4-9] | ss99)$

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM