Forums / General Questions / Shopping Cart Product Item External Page URL

Shopping Cart Product Item External Page URL

Locked

Views: 1,530

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
3 Nov 2010, 8:43 AM
#1
botrot avatar

botrot

New Zenner

Join Date:
Sep 2010
Location:
Australia
Posts:
11
Plugin Contributions:
0

Shopping Cart Product Item External Page URL

Hello Forum,

I am working on a website that has custom, external product pages. When products are added to the cart, the default link is to the Zen Cart product page for that particular product item (for all good reasons).

I'd like to (if possible) to change this default url linking to it's custom page. The url for the custom page is defined in the MySql table;

products_description

In the field;

products_url

From the, tpl_shopping_cart_default.php, code the, foreach ($productArray as $product), array doesn't have the products url defined as an element within it so the,

<a href="<?php echo $product['linkProductsName']; ...

Cannot be altered with any item/value within the array. Is there anyway I can add a key such that;

productExternalPageUrl => assigned as the products_description.products_url value

to the $productArray above.

Thanks and regards,

  • BotRot
5 Nov 2010, 9:12 AM
#2
botrot avatar

botrot

New Zenner

Join Date:
Sep 2010
Location:
Australia
Posts:
11
Plugin Contributions:
0

Re: Shopping Cart Product Item External Page URL

OK for those of you out there that want to know how to do this, or have a customer that insists that their product items in their shopping cart, link to their external (very pretty) pages, here is how. First implement this at your own volition, I can't assure you I can answer all questions regarding this, or know of contingencies in Zen Cart I may have neglected by the virtue of my own ignorance. Here we go;

First

Make sure your products have a product url either, set using the Product\Category in the admin, or in the products_description table, products_url field.

Second

includes/classes/shopping_cart.php

Line 1074 (in my case), add the following to the sql statement, pd.products_url
Line 1210 (in my case), add the following to the array, ,'purl' => $products->fields['products_url']

Third

includes/modules/pages/shopping_cart/header_php.php

Line 85 (in my case), add the following variable assignment, $productsURL = $products[$i]['purl'];
Line 168 (in my case), add the following array key/value, ,'productURL' => $productsURL

Then

includes/templates/template_default/templates/tpl_shopping_cart_default.php

Find the line that has;
<a href="<?php echo $product['linkProductsName']; ?>"><span id="cartImage"...

and change 'linkProductsName', to 'productsURL'.

Hope this can help out someone else too, then it was really worth it.

Thanks and regards,

  • BotRot