Announcement

Collapse
No announcement yet.

Changing the href for the quoteitem to item's entity name

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Changing the href for the quoteitem to item's entity name

    When I add item to the quoteitems in quote entity, I can click a link that directs me to the view. The template makeup for the href is in detail.tpl and the url is <a href="{{scope}}/View/{{productId}}">{{value}}</a>. I want to change {{scope}} which is right now, "#QuoteItem". I had modified the code to add different entity as oppose to product. I'm not sure where the scope value is located. Once user selects an item, I want to change it to the item's entity name.

  • #2
    I added a field in quoteitem.json.
    Code:
    "itemEntity": {
    Code:
    [COLOR=#252C2F][FONT=Helvetica][SIZE=13px]"type":"varchar"}[/SIZE][/FONT][/COLOR][COLOR=#252C2F][FONT=Helvetica][SIZE=13px][/SIZE][/FONT][/COLOR]
    Then I added
    PHP Code:
    'itemEntity' => $o->itemEntity 
    in the quoteitems hook. Then in quote-item/field/name, I added
    Code:
    data['nameScope'] = this.model.get('itemEntity');
    //in data function
    Code:
      [COLOR=#252C2F][FONT=Helvetica][SIZE=13px]//and in this.model.set[/SIZE][/FONT][/COLOR]
       
      [COLOR=#252C2F][FONT=Helvetica][SIZE=13px]this.model,set({[/SIZE][/FONT][/COLOR]
      [COLOR=#252C2F][FONT=Helvetica][SIZE=13px]itemEntity: product.name[/SIZE][/FONT][/COLOR]
      [COLOR=#252C2F][FONT=Helvetica][SIZE=13px]})[/SIZE][/FONT][/COLOR]
       
      [COLOR=#252C2F][FONT=Helvetica][SIZE=13px]//and in name/detail.tpl, I changed the href to[/SIZE][/FONT][/COLOR]
      [COLOR=#252C2F][FONT=Helvetica][SIZE=13px]<a href="#{nameScope"/view/id>[/SIZE][/FONT][/COLOR]
    But the value isn't being set for itemEntity.

    Comment


    • #3
      I figured it out. I had to add
      Code:
      itemEntity: this.model.get('itemEntity') || null
      to the fetch method in advanced/quote/record/item directory. Now it's figuring out how to change status based on parent's status, using the itemEntity field.

      Comment

      Working...
      X