douhui4699 2016-12-30 17:01
浏览 42

如何为多个国家/地区设置送货方式?

in my script a seller can set one national shipping-cost and one international, but thats not enough. If a customer is sitting in a country at the other side of the world, its much more expensive as he is sitting at the neighbour Country.

My Idea was to give the seller the ability to chose 13 Countrys and Regions and set the shipping-cost for it. The biggest problem is, if the seller choose i.e. 10 of the 13 Regions, the "shipping-country list" is much to long at the article page. What is the best solution to store multiple Shipping-Costs and Methods in mysql and show only the relevant entrys to the customer?

In mysql i was thinking the following is the best solution:

id|article|shipping-desc |price|japan|china|europe|america|england|german|
1 |134    |Pakage        |5,90 |  0  |  0  |  0   |   0   |   0   |   1 
2 |134    |Insured-Pakage|23,90|  0  |  0  |  1   |   1   |   1   |   0 
3 |134    |Insured-Pakage|43,90|  1  |  1  |  0   |   0   |   0   |   0

Then take the datas from mysql to the article-page to show them to the customer:

SHIPPINGCOST(NATIONAL)        5,90€  -  Pakage
SHIPPINGCOST(INTERNATIONAL)   23,90€ -  Insured-Pakage (europe,america,england,one more,...)
SHIPPINGCOST(INTERNATIONAL)   43,90€ -  Insured-Pakage (japan,china)

And there it is much to long if there are more than two or three countrys. Has anyone a really good solution that dont messed up my article page?

Best greetings from Germany!

  • 写回答

1条回答 默认 最新

  • dongyulian5801 2016-12-30 17:11
    关注

    You should use normalized table eg:

    table articles 
    id, article_code, shipping_desc_id, country_area_code, price
    1, 134, 1, GER, 5,90
    2, 134, 2, RPC, 23,90  
    3, 134, 2, AME, 23,90  
    
    
    
    table country_area
    country_area_code, country_area_name
    JPN, japan
    PRC, china
    AME, america
    GER, German
    
    
    shipping_method 
    shipping_desc_id, shipping_desc_name
    1, Package
    2, Insured-Pakage
    
    评论

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么