diff --git a/application/Address/AddressController.php b/application/Address/AddressController.php index 008555856..7801b5748 100644 --- a/application/Address/AddressController.php +++ b/application/Address/AddressController.php @@ -126,8 +126,9 @@ class AddressController extends mfBaseController { $attribs = $r->attributes; //var_dump($attribs);exit; if(is_array($attribs) && count($attribs)) { - foreach($attribs as $atttrib => $value) { + foreach($attribs as $attrib => $value) { $aa = AddressattributeModel::getFirst(["address_id" => $new_id, "name" => $attrib]); + if(!$aa) { $aa = AddressattributeModel::create(["address_id" => $new_id, "name" => $attrib]); } diff --git a/application/Pop/Pop.php b/application/Pop/Pop.php index 638f7e08a..d242218dc 100644 --- a/application/Pop/Pop.php +++ b/application/Pop/Pop.php @@ -1,5 +1,22 @@ $name == null) { + + $classname = ucfirst($name); + $idfield = $name."_id"; + $this->$name = new $classname($this->$idfield); + + if($this->$name->id) { + return $this->$name; + } else { + return null; + } + } + + return $this->$name; + } } \ No newline at end of file diff --git a/application/Pop/PopModel.php b/application/Pop/PopModel.php new file mode 100644 index 000000000..3ac00faa6 --- /dev/null +++ b/application/Pop/PopModel.php @@ -0,0 +1,8 @@ +