Input forms on custom attributes

Permalink
I am looking for feedback on the 'correctness' of my approach here. First, I will describe what the goal is:

Using the eCommerce Package, I want to add an attribute type of "Review", which when displayed on the front end is an input form for users to type up their review of a product. There will be an additional new attribute type of "Reviews" which will be a collection of "Review" entries, and will display itself as non-editable reviews by other users.

I am going to worry about the collection of reviews type later, and for now just make a bogus single review form to test my understanding.

I have created the Review attribute, installed it, added it to the product page view, and now I run into a question about the correctness of how to proceed:

I modified getDisplayValue() just to see what would happen:
public function getDisplayValue() {
      $v = Loader::helper('text')->entities($this->getValue());
      $ret = nl2br($v);
      $return = "<form><textarea name='review'>$ret</textarea><input type='submit' value='Submit Review'/> </form>";
      return $return;
   }


Which, from a purely visual standpoint starts me on the right road of creating the review form for users.
But I start to think about where that form posts to, and where i implement the post-handling, and I'm not sure about this approach.

Is there a more concrete-5 way to do this? is there supposed to be certain controller functions i should set up to handle this data type?

1 Attachment

 

This website stores cookies on your computer. These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media. To find out more about the cookies we use, see our Privacy Policy.