LemonStand Forum: PopupForm from partial - LemonStand Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

PopupForm from partial

#1 User is offline   billy 

  • Member
  • Group: Members
  • Posts: 5
  • Joined: 06-December 11

Posted 22 January 2012 - 10:54 AM

I've extended the customer model to include a table of products and I want to be able to see that product data via a popup. In my custom module, I'm successfully displaying a partial (_necklaces.htm) that's listing the necklaces.

In that list, I'm defining an onclick that isn't working.

_necklaces.htm partial:
<? $onClick = "new PopupForm('onCustomEvent', {ajaxFields: {custom_event_handler: 'aapnecklaces:onLoadNecklaces'}}); return false;";?>
<td onclick="<?= $onClick ?>"><?= $necklace->name ?></td>


aapnecklaces_module.php:
public function subscribeEvents()
{
	Backend::$events->addEvent('aapnecklaces:onLoadNecklaces', $this, 'load_necklace');
}

public function load_necklace($controller,$customer)
{
	$controller->renderPartial(PATH_APP.'/modules/aapnecklaces/partials/_necklace_preview.htm');
}


I get the popup but the _necklace_preview partial isn't loading.

Any ideas?
0

#2 User is offline   Aleksey 

  • Co-Founder
  • Group: +Administrators
  • Posts: 3,633
  • Joined: 31-October 09

Posted 24 January 2012 - 03:09 PM

Hi Billy,

The onCustomEvent event is not implemented for the Customers controller, but we will publish it today. The handler will be getting the customer ID instead of the customer object, so you will need to load the customer in the handler:

public function load_necklace($controller,$customer_id)
{
    $customer = Shop_Customer::create()->find($customer_id);
    $controller->renderPartial(PATH_APP.'/modules/aapnecklaces/partials/_necklace_preview.htm');
}

Thank you

Share this topic:


Page 1 of 1

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users