Page 1 of 2

Pepperjam Pixel Implementation

Posted: Thu Oct 03, 2013 7:39 pm
by drbyte
Hi, we are trying to implement Pepperjam Pixel into the sucess.tpl page
So far we got one item to work using this

Code: Select all

<iframe src="https://t.pepperjamnetwork.com/track?PID=XXXX&INT=ITEMIZED&ITEM1=<?php echo $product['product_id']; ?>&QTY1=<?php echo $product['quantity']; ?>&AMOUNT1=<?php echo $product['price']; ?>&OID=<?php echo $product['order_id']; ?>" width="1" height="1" frameborder="0"></iframe>	
But that will only display the first item sold but not the others.

This is what they have as far php goes:

Code: Select all

<?php
$output = '<iframe src="https://t.pepperjamnetwork.com/track?';
$output .="PID=000";
$output .="&INT=ITEMIZED";
$output .="&ITEM1=$itemID1";
$output .="&ITEM2=$itemID2";
$output .="&QTY1=$quantity1";
$output .="&QTY2=$quantity2";
$output .="&AMOUNT1=$salePrice1";
$output .="&AMOUNT2=$salePrice2";
$output .="&OID=$orderID";
$output .='" width="1" height="1" frameborder="0"></iframe>';
echo $output;
?>
<-- This will create the following: //-->

Code: Select all

<iframe src="https://t.pepperjamnetwork.com/track?PID=000&INT=ITEMIZED
&ITEM1=P1473&ITEM2=P1894&AMOUNT1=20.00&AMOUNT2=10.00
&QTY1=3&QTY2=4&OID=54563131" width="1" height="1" frameborder="0"></iframe>


Can anybody help us on this to try to get it to work so all items sold can show up on their end

We tried multiple codes but all got us syntax errors. We looked at the google tracking ecommerce script by extensadev.com but that also did not work too.

If anybody got an idea of how, please post or you can email me with a price if possible.

Thanks

Sam

Re: Pepperjam Pixel Implementation

Posted: Thu Oct 03, 2013 7:48 pm
by MarketInSG

Code: Select all

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'");

foreach ($query->rows as $result) {
$product_id = $result['product_id'];
.......
}
A quick example on fetching from the database. You will need to get the correct order ID for the job too

Re: Pepperjam Pixel Implementation

Posted: Fri Oct 04, 2013 3:24 pm
by drbyte
Thank you,

I will try that. If not then if you want to make extra on the side, please email me. sirrieh70 at gmail dot com

Thank you again

Sam

Re: Pepperjam Pixel Implementation

Posted: Fri Oct 04, 2013 3:27 pm
by drbyte
BTW, I like your quick checkout. Does it work with PayPal Pro?

Thanks

Re: Pepperjam Pixel Implementation

Posted: Fri Oct 04, 2013 3:33 pm
by MarketInSG
Yes, the Quick Checkout works with all payment modules :)

I provide free support through the forums, so if you have any questions with the query you need, go ahead and shoot. Will be back once or twice a day to make a response.

Re: Pepperjam Pixel Implementation

Posted: Fri Oct 04, 2013 3:43 pm
by drbyte
Thank You,

we are getting lots of abandoned cart items and it seems the normal checkout process is lengthy for some. Will get it in few

As far the code goes, here's what i tried to put together!

Code: Select all

<?php 
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'");

$output = '<iframe src="https://t.pepperjamnetwork.com/track?';
$output .="PID=0000";
$output .="&INT=ITEMIZED";

foreach ($query->rows as $result) {
$product_id = $result['product_id'];
$quantity = $result['quantity'];
$price = $result['price'];
$order_id = $result['order_id'];
}
$output .='" width="1" height="1" frameborder="0"></iframe>';
?>

Re: Pepperjam Pixel Implementation

Posted: Fri Oct 04, 2013 4:07 pm
by drbyte
Just got your quick checkout :) will play with it tonight. If I have any issues I will email your support.

Thanks again

If you got any extra help with the PepperJam script please update.

Sam

Re: Pepperjam Pixel Implementation

Posted: Sat Oct 05, 2013 11:19 am
by MarketInSG
What you have isn't correct.

edit catalog/controller/checkout/success.php and find

Code: Select all

if (isset($this->session->data['order_id'])) {
BELOW it add

Code: Select all

$order_id = (int)$this->session->data['order_id'];
and find

Code: Select all

$this->data['continue'] = $this->url->link('common/home');
ABOVE it add

Code: Select all

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'");

$output = '<iframe src="https://t.pepperjamnetwork.com/track?';
$output .="PID=0000";
$output .="&INT=ITEMIZED";

$count = 1;

foreach ($query->rows as $result) {
	$output .= '&ITEM' . $count . '=' . $result['product_id'];
	$output .= '&QTY' . $count . '=' . $result['quantity'];
	$output .= '&AMOUNT' . $count . '=' . $result['total'];
	
	$count++;
}

$output .='&OID=' . $order_id . '" width="1" height="1" frameborder="0"></iframe>';

$this->data['message'] = $this->data['message'] . $output;
I don't know what PID stands for in their implementation, but I roughly get it up from what you gave.

Re: Pepperjam Pixel Implementation

Posted: Sat Oct 05, 2013 12:57 pm
by drbyte
Thank You so much.

Did add the code to the hp file without any errors. after I complete the order, when I look at the source code, I d o not see the output. Do I have to add the same code to the tpl file too?

Thanks again.

Sam

Re: Pepperjam Pixel Implementation

Posted: Sat Oct 05, 2013 1:01 pm
by MarketInSG
it should be appended to the end of the success message.

Re: Pepperjam Pixel Implementation

Posted: Sat Oct 05, 2013 1:04 pm
by drbyte
Hi

I tried many times but nothing.

Thanks

Re: Pepperjam Pixel Implementation

Posted: Sat Oct 05, 2013 1:11 pm
by MarketInSG
what would be the URL of your website?

Re: Pepperjam Pixel Implementation

Posted: Sat Oct 05, 2013 1:17 pm
by drbyte

Re: Pepperjam Pixel Implementation

Posted: Sun Oct 06, 2013 11:54 am
by MarketInSG
Just curious, how does your checkout.php file looks like now? After successful payment, it should redirect to checkout/success, and the iframe should be appended to the message (hidden).

Re: Pepperjam Pixel Implementation

Posted: Sun Oct 06, 2013 1:05 pm
by drbyte
Hi,,

at the vqmod side it looks like this: changed the Dir to quickcheckout

Code: Select all

<?php 
class ControllerCheckoutCheckout extends Controller { 
	public function index() {
				$quickcheckout_status = $this->config->get('quickcheckout_status');
				if ($quickcheckout_status == 1) {
					$this->redirect($this->url->link('quickcheckout/checkout', '', 'SSL'));
				}		
		// Validate cart has products and has stock.
		if ((!$this->cart->hasProducts() && empty($this->session->data['vouchers'])) || (!$this->cart->hasStock() && !$this->config->get('config_stock_checkout'))) {
	  		$this->redirect($this->url->link('checkout/cart'));
    	}			
		// Validate minimum quantity requirments.			
		$products = $this->cart->getProducts();
		foreach ($products as $product) {
			$product_total = 0;			
			foreach ($products as $product_2) {
				if ($product_2['product_id'] == $product['product_id']) {
					$product_total += $product_2['quantity'];
				}
			}		
			if ($product['minimum'] > $product_total) {
				$this->redirect($this->url->link('checkout/cart'));
			}
		}
		$this->language->load('checkout/checkout');
		$this->document->setTitle($this->language->get('heading_title')); 
		$this->data['breadcrumbs'] = array();
      	$this->data['breadcrumbs'][] = array(
        	'text'      => $this->language->get('text_home'),
			'href'      => $this->url->link('common/home'),
        	'separator' => false
      	); 
      	$this->data['breadcrumbs'][] = array(
        	'text'      => $this->language->get('text_cart'),
			'href'      => $this->url->link('checkout/cart'),
        	'separator' => $this->language->get('text_separator')
      	);
      	$this->data['breadcrumbs'][] = array(
        	'text'      => $this->language->get('heading_title'),
			'href'      => $this->url->link('checkout/checkout', '', 'SSL'),
        	'separator' => $this->language->get('text_separator')
      	);
	    $this->data['heading_title'] = $this->language->get('heading_title');
		$this->data['text_checkout_option'] = $this->language->get('text_checkout_option');
		$this->data['text_checkout_account'] = $this->language->get('text_checkout_account');
		$this->data['text_checkout_payment_address'] = $this->language->get('text_checkout_payment_address');
		$this->data['text_checkout_shipping_address'] = $this->language->get('text_checkout_shipping_address');
		$this->data['text_checkout_shipping_method'] = $this->language->get('text_checkout_shipping_method');
		$this->data['text_checkout_payment_method'] = $this->language->get('text_checkout_payment_method');		
		$this->data['text_checkout_confirm'] = $this->language->get('text_checkout_confirm');
		$this->data['text_modify'] = $this->language->get('text_modify');
		$this->data['logged'] = $this->customer->isLogged();
		$this->data['shipping_required'] = $this->cart->hasShipping();	
		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/checkout/checkout.tpl')) {
			$this->template = $this->config->get('config_template') . '/template/checkout/checkout.tpl';
		} else {
			$this->template = 'default/template/checkout/checkout.tpl';
		}
		$this->children = array(
			'common/column_left',
			'common/column_right',
			'common/content_top',
			'common/content_bottom',
			'common/footer',
			'common/header'
		);
		$this->response->setOutput($this->render());
  	}
	public function country() {
		$json = array();
		$this->load->model('localisation/country');
    	$country_info = $this->model_localisation_country->getCountry($this->request->get['country_id']);
		if ($country_info) {
			$this->load->model('localisation/zone');
			$json = array(
				'country_id'        => $country_info['country_id'],
				'name'              => $country_info['name'],
				'iso_code_2'        => $country_info['iso_code_2'],
				'iso_code_3'        => $country_info['iso_code_3'],
				'address_format'    => $country_info['address_format'],
				'postcode_required' => $country_info['postcode_required'],
				'zone'              => $this->model_localisation_zone->getZonesByCountryId($this->request->get['country_id']),
				'status'            => $country_info['status']
			);
		}
		$this->response->setOutput(json_encode($json));
	}
}
?>

"and the iframe should be appended to the message (hidden)." Is it possible to view the iframe values at the sourcecode. They, pepperjam needs to see it there to validate the code.

Thank you

Sam

Re: Pepperjam Pixel Implementation

Posted: Sun Oct 06, 2013 6:17 pm
by drbyte
Hi,

Got all working now :) I just added

echo $output;

Thank you so so much for your help. We will be in touch via PayPal On Monday.

Thank you again.

Sam

Re: Pepperjam Pixel Implementation

Posted: Sun Oct 06, 2013 7:00 pm
by MarketInSG
I made a typo on the above message. I need to see the output at checkout/success.php.

Code: Select all

$this->data['message'] = $this->data['message'] . $output;
The code above should append the iframe to the message. Not sure what was messed up, but glad you have it solved.

Re: Pepperjam Pixel Implementation

Posted: Sun Oct 06, 2013 7:30 pm
by drbyte
Hi

Code: Select all

<?php echo $header; ?><?php echo $column_left; ?><?php echo $column_right; ?>
<div id="content"><?php echo $content_top; ?>
  <div class="breadcrumb">
    <?php foreach ($breadcrumbs as $breadcrumb) { ?>
    <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a>
    <?php } ?>
  </div>
  <h1><?php echo $heading_title; ?></h1>
  <?php echo $text_message; ?>
  <div class="buttons">
    <div class="right"><a href="<?php echo $continue; ?>" class="button"><?php echo $button_continue; ?></a></div>
  </div>
  <?php echo $content_bottom; ?></div>
				<?php if (isset($ecommerce_tracking_status)) { ?>
					<?php if ($ecommerce_tracking_status && $order && $products) { ?>
						<?php echo $start_google_code; ?>
						_gaq.push(['_set', 'currencyCode', '<?php echo $order['currency_code']; ?>']);
						_gaq.push(['_addTrans',
							"<?php echo $order['order_id']; ?>",
							"<?php echo $order['store_name']; ?>",
							"<?php echo $order['order_total']; ?>",
							"<?php echo $order['order_tax']; ?>",
							"<?php echo $order['order_shipping']; ?>",
							"<?php echo $order['payment_city']; ?>",
							"<?php echo $order['payment_zone']; ?>",
							"<?php echo $order['payment_country']; ?>"
						]);
						<?php foreach($products as $product) { ?>
						_gaq.push(['_addItem',
							"<?php echo $product['order_id']; ?>",
							"<?php echo ($product['sku'] ? $product['sku'] : $product['product_id']); ?>",
							"<?php echo $product['name']; ?>",
							"<?php echo $product['category']; ?>",
							"<?php echo $product['price']; ?>",
							"<?php echo $product['quantity']; ?>"
						]);
						<?php } ?>
						_gaq.push(['_trackTrans']);
						<?php echo $end_google_code; ?>
					<?php } else { ?>
						<?php echo $google_analytics; ?>
					<?php } ?>
				<?php } ?>
			
<?php echo $footer; ?>

Re: Pepperjam Pixel Implementation

Posted: Sun Oct 06, 2013 7:58 pm
by MarketInSG
seems like your template is a little different. You can replace

Code: Select all

$this->data['message'] = $this->data['message'] . $output;
with

Code: Select all

$this->data['code'] = $output;
and go to the template file and put in <?php echo $code; ?>

Re: Pepperjam Pixel Implementation

Posted: Sun Oct 06, 2013 9:34 pm
by drbyte
Perfect, Thank you..Works 100%

Sam