<modification>
	<name>PersistentCart by iSenseLabs</name>
	<version>3.4.5</version>
	<link>http://isenselabs.com</link>
	<author>iSenseLabs</author>
	<code>isenselabs_persistentcart</code>
	<file path="system/library/cart/cart.php">

        <operation>
          <search><![CDATA[date_added = NOW()"]]></search>
          <add position="replace"><![CDATA[date_added = NOW(), visitor_ip='" . \vendor\isenselabs\persistentcart\systemlibraryclassadditions::getVisitorIp()."'"]]></add>
        </operation>
        <operation>
          <search><![CDATA[$this->weight = $registry->get('weight');]]></search>
          <add position="after"><![CDATA[
		$this->registry = $registry;
		if (empty($_GET['user_token'])){ // Not invoking PersistentCart for admin cart manipulations
			 \vendor\isenselabs\persistentcart\systemlibraryclassadditions::findAndRecoverPersistentCartIfEnabled($registry);
		}
]]></add>
        </operation>
        <operation>
          <search index="0"><![CDATA[public function add]]></search>
          <add position="after"><![CDATA[
		  //If PersistentCart is enabled, if it is called outside admin area, and if it is set to use cookies to store carts
		  if (\vendor\isenselabs\persistentcart\systemlibraryclassadditions::getPcConfig($this->registry, 'Enabled') == 'yes' && empty($_GET['user_token']) && strpos(\vendor\isenselabs\persistentcart\systemlibraryclassadditions::getPcConfig($this->registry,'Method'),'cookies') !== false) {
			setcookie("pc_cookie", $this->session->getId(), strtotime('+'.\vendor\isenselabs\persistentcart\systemlibraryclassadditions::getPcConfig($this->registry, 'Limit').' days'), '/');
		  }

]]></add>
        </operation>
        <operation>
          <search index="0"><![CDATA[INTERVAL ]]></search>
          <add position="before"><![CDATA[
		  $interval = "INTERVAL 1 HOUR";
		  if (\vendor\isenselabs\persistentcart\systemlibraryclassadditions::getPcConfig($registry, 'Enabled') == 'yes') {
			$interval = "INTERVAL " . (int)(\vendor\isenselabs\persistentcart\systemlibraryclassadditions::getPcConfig($registry, 'Limit'))  . " DAY";
		  }

]]></add>
        </operation>
        <operation>
          <search index="1"><![CDATA[INTERVAL 1 HOUR]]></search>
          <add position="replace"><![CDATA[$interval]]></add>
        </operation>
	</file>
</modification>
