-1

I'm developing something like a content component I choose a specific item through Menu Items component and choose what item i want so that once i navigate to that menu I can see the item i choose however on the frontend model of my component the desired functionality didn't work instead of getting the Second Item from the table it retrieves always the First Item. see the sample snippets of my getData and getState. and btw $id value must be 2 and not 1.

Please help me to fix this. Thanks.

  public function &getData($id = null) {

    if ($this->_item === null) {
        $this->_item = false;
        if (empty($id)) {
        $id = $this->getState('articlefile.id');
 }
  • Your question is not that descriptive. I am getting no idea what you want to do after all. Please describe your problem in detail. – Saurin Dashadia Mar 13 '15 at 7:16
  • I'm trying to retrieve the second item i choose using the menu item however on the getData function in my frontend model always return the first row of the table. – Voj Mar 13 '15 at 7:22
0

Closed on my "populateState" function inside my frontend model for a single item. I changed my code to this.

  if (isset($params_array['item_id'])) {
        $this->setState('articlefile.id', $id);
        // change $params_array['item_id'] to $id
    }

this previous code before changing is to determine if the item_id is already set and then it is the one assign to the "articlefile.id" that is why always the first row is being retrieved from the table.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.