Once and a while you may want to get a collection of the regions that are associated with a country in Magento. For example, the United States is of course a collection of… states. In Magento these are referred to as regions (Japan’s prefectures would hence be referred to as regions as well.)
So for a given country (and that country’s ID or country code) you might want to find all the regions in that country. Which are usually used to populate a dropdown menu on the address selection pages or shipping tax pages.
$collection = Mage::getModel('directory/region')->getResourceCollection() ->addCountryFilter($this->getCountryId()) ->load();
It’s great when ORM works for a developer. The problem with Magento I find is the complete lack of documentation. I only discovered the above technique after 20 minutes of grepping the app/code/core directory…
foreach($collection as $region) { Mage::log(print_r($region, true)); }
Note some of the more useful attributes of that $region object are:
$region->getData('default_name') $region->getData('code')
Which give responses along the lines of South Australia and SA, respectively.
相关推荐
ch07-code-listing.ipynb
ch13-code-listing.ipynb
标题中的"Project Listing System using C++ with Source Code.zip"表明这是一个使用C++编程语言开发的项目清单系统,其中包含了源代码。这个系统可能用于管理、跟踪和组织各种项目信息,如项目名称、负责人、进度、...
Listing the files inside a directory http://www.geekpedia.com/tutorial148_Listing-the-files-inside-a-directory.html
以上是对“Simple Duty Listing App in JavaScript Free Source Code”这个项目的简要分析。通过学习和理解这个应用的源代码,开发者不仅可以提升JavaScript技能,还能了解前端开发的基本流程和最佳实践。
本项目名为“Movie Listing App”,完全基于JavaScript语言实现,旨在帮助用户方便地管理和浏览电影信息。通过学习和分析这款应用的源代码,我们可以深入理解JavaScript在构建Web应用中的强大功能。 一、JavaScript...
亚马逊Listing视频文件下载谷歌插件是一款专为亚马逊平台的运营人员设计的实用工具,它极大地简化了下载Listing中展示的视频文件的过程。在电子商务领域,尤其是亚马逊这样的大型平台,产品视频已经成为提高销售转化...
15.2.9 Creating a Cross-Reference-Listing File 15.2.10 Performing Consistency Checks 15.2.11 Setting the Library-Page Size Chapter 16 NMAKE 16.1 Invoking NMAKE 16.1.1 Using a Command Line to Invoke ...
This method a new instance of a Listing object that contains only those advertisements whose name or description contains the string given by the parameter keyword. If the parameter keyword equals ...
这是一个关于使用Python编程语言开发任务列表应用程序的开源代码项目。这个应用可能是一个简单的命令行界面或者GUI工具,用于创建、查看、编辑和删除日常任务。下面我们将深入探讨Python编程、任务管理应用程序的...
亚马逊打造listing.jpg.zip" 指的是一个压缩文件,其中包含了一个关于如何在亚马逊平台上创建和优化产品Listing的教程或指南的图像文件。这个压缩包的核心内容是帮助跨境电商卖家理解并提升他们在亚马逊上的产品展示...
1、如何创建listing?
Generating subsets of a given word involves listing all possible subwords. This section explores algorithms for efficiently generating such subsets. #### 1.26 Binary Words in Lexicographic Order for ...
在"Embedded SoPC Design with Nios II Processor and Verilog Examples"这一主题中,我们将深入探讨如何构建一个嵌入式片上系统(System on a Programmable Chip, SoPC),并结合Nios II处理器和Verilog编程语言...
C++并发编程实战代码
在亚马逊平台上,卖家有时会发现一个已有热销产品的listing,希望将自己的产品添加到这个成功的商品页面下,形成变体,共享其流量和销量。这被称为“建立他人的刊登(listing)变体”。本教程将深入讲解如何操作这一...
本文将深入探讨“动态内存”这一主题,结合提供的文件"Code-Listing-4.1---Dynamic-Memory.zip_memory",我们将会解析其中的源代码,并解释动态内存分配和释放的基本概念。 动态内存分配允许程序在运行时决定需要...
C++并发编程实战代码
C++并发编程实战代码