/** * Add last available view event_id * We don't have any useragent data available just by sending out * an email. However we might have data from previous campaigns that we can borrow. * * We use the address ID to search crosswide around all address * * @todo Add a time limit so we don't use to old data * @param Mzax_Emarketing_Db_Select $select */ protected function joinLastViewEvent(Mzax_Emarketing_Db_Select $select, $type = Mzax_Emarketing_Model_Recipient::EVENT_TYPE_VIEW) { if ($select->hasAnyBindings('country_id')) { return; } $select->joinTable('address_id', 'recipient_address', 'address'); $select->joinTable(array('event_id' => '`address`.`view_id`'), 'recipient_event', 'event'); $select->addBinding('event_id', 'event.event_id'); $select->addBinding('country_id', 'event.country_id'); }
/** * Add last available view event_id * We don't have any useragent data available just by sending out * an email. However we might have data from previous campaigns that we can borrow. * * We use the address ID to search crosswide around all address * * @todo Add a time limit so we don't use to old data * @param Mzax_Emarketing_Db_Select $select */ protected function joinLastViewEvent(Mzax_Emarketing_Db_Select $select) { if ($select->hasAnyBindings('event_id', 'useragent_id')) { return; } $select->joinTable('address_id', 'recipient_address', 'address'); $select->joinTable(array('event_id' => '`address`.`view_id`'), 'recipient_event', 'last_view_event'); $select->addBinding('event_id', 'last_view_event.event_id'); $select->addBinding('useragent_id', 'last_view_event.useragent_id'); }