Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Well, I've figured it out. Although I must admit it's not the cleanest solution, it works exactly as I had hoped. For anyone else who's looking to do this, I've pasted my code excerpt below:</p> <pre><code>require 'app/Mage.php'; $mageRunCode = isset ( $_SERVER ['MAGE_RUN_CODE'] ) ? $_SERVER ['MAGE_RUN_CODE'] : ''; $mageRunType = isset ( $_SERVER ['MAGE_RUN_TYPE'] ) ? $_SERVER ['MAGE_RUN_TYPE'] : 'store'; $app = Mage::app ( $mageRunCode, $mageRunType ); $core_session = Mage::getSingleton ( 'core/session', array ('name' =&gt; 'frontend' ) ); $write = Mage::getSingleton ( 'core/resource' )-&gt;getConnection ( 'core_write' ); $url = Mage::getUrl ( '*/*/*', array ('_current' =&gt; true ) ); Mage::getSingleton ( 'core/session' )-&gt;setLastUrl ( $url ); $visitor_id = $_SESSION ['core'] ['visitor_data'] ['visitor_id']; if (! empty ( $visitor_id )) { Mage::getSingleton ( 'log/visitor' )-&gt;setId ( $visitor_id ); } else { Mage::getSingleton ( 'customer/session' )-&gt;setWishlistItemCount ( 0 ); Mage::getSingleton ( 'catalog/session' )-&gt;setCatalogCompareItemsCount ( 0 ); $write-&gt;query ( "INSERT INTO log_url_info (url, referer) VALUES (?, ?)", array ($url, Mage::helper ( 'core/http' )-&gt;getHttpReferer ( true ) ) ); $url_id = $write-&gt;lastInsertId (); $log_visitor = Mage::getSingleton ( 'log/visitor' )-&gt;initServerData ()-&gt;setFirstVisitAt ( now () )-&gt;setIsNewVisitor ( true )-&gt;setLastVisitAt ( now () )-&gt;setLastUrlId ( $url_id )-&gt;save (); $write-&gt;query ( "INSERT INTO log_url (url_id, visitor_id, visit_time) VALUES (?, ?, ?)", array ($url_id, $log_visitor-&gt;getId (), now () ) ); $core_session-&gt;setVisitorData ( $log_visitor-&gt;getData () ); $visitor_id = $log_visitor-&gt;getId (); } </code></pre> <p>I hope this helps someone else so they're not ripping their hair out like I was.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload