Forums / Addon Admin Tools / Twitch Product Image Link on Account History

Twitch Product Image Link on Account History

Started by twitchtoo on 11 Mar 2022, 6:35 AM · Views: 739

Results 1 to 3 of 3
11 Mar 2022, 6:35 AM
#1
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Twitch Product Image Link on Account History

Twitch Product Image Link on** Account History**

Display product images with link-back to product on order account history display. Alternate click to reorder (add to cart) link included.

**Admin > Configuration **> Layout Settings

SQL Update - Add new switch

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Show <b>Product Image Link</b> on Account History', 'SHOW_PRODUCT_IMAGELINK_ACCOUNT_HISTORY', 'Show', 'Hide = Stock Product Name Text (no image) <br/><br/> Tracer: SHOW_PRODUCT_IMAGELINK_ACCOUNT_HISTORY <br/><br/> Default => Show', '19', '224', 'zen_cfg_select_option(array('Show', 'Hide'), ', now());

DELETE CODE

DELETE FROM configuration WHERE configuration_key in ('SHOW_PRODUCT_IMAGELINK_ACCOUNT_HISTORY');

DELETE CODE

**includes/templates/YOUR_TEMPLATE/templates/tpl_account_history_info_default.php
**
replace this:
echo $order->products[$i]['name'];

with this:
// Twitch Base7 for 1.57c
if (SHOW_PRODUCT_IMAGELINK_ACCOUNT_HISTORY == 'Show') {
$reorder_image = zen_get_products_image($order->products[$i]['id'], IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT); // Twitch Fast Image Lookup

// Add to cart (click to reorder)
// Twitch hide - echo '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=cust_order&pid=' . $order->products[$i]['id']) . '">'.$reorder_image. $order->products[$i]['name'] .'</a></li><br>' . "\n" ;

// Show product link
echo '<a href="' . zen_href_link(zen_get_info_page($order->products[$i]['id']), 'products_id=' . $order->products[$i]['id']) . '">' . $reorder_image.' '.$order->products[$i]['name'] . '</a>';
} else { // stock
echo $order->products[$i]['name'];
}

Tracer: Twitch Base7

Your coffee donations are appreciated
:cheers:

Twitch.
https://www.twitchtoo.com Do you work for free? Please donate.
June 7.2026 - NOW AVAILABLE - Twitch Base8 - Obsidian

11 Mar 2022, 1:07 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,119
Plugin Contributions:
56

Re: Twitch Product Image Link on Account History

Nice idea, but what happens if the purchased product is no longer available?

11 Mar 2022, 4:18 PM
#3
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Re: Twitch Product Image Link on Account History

With my first post the cart follows normal stock rules about things missing:

Sorry the product was not found.
[Continue]

You could customize the message/page if you feel your customers need more options.

**Or

** You could use the Twitch Base7 Commercial version:

Twitch Product Image Link on Account History

SQL Update - Add new switches

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Show <b>Product Image Link</b> on Account History', 'SHOW_PRODUCT_IMAGELINK_ACCOUNT_HISTORY', 'Show', 'Hide = Stock Product Name Text (no image) <br/><br/> Link will only show if product stock > 1 or product status = ON <br/>Tracer: SHOW_PRODUCT_IMAGELINK_ACCOUNT_HISTORY <br/><br/> Default => Show', '19', '224', 'zen_cfg_select_option(array('Show', 'Hide'), ', now());

INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Show <b>Product Image Link</b> on Account History - Link Type', 'IMAGELINK_ACCOUNT_HISTORY_LINK_TYPE', 'Image', '<b>Image</b> = Display link to product <br/> <b/>Reorder</b> = Display as add to cart link <br/><br/> Default => Image', '19', '226', 'zen_cfg_select_option(array('Image', 'Reorder'), ', now());

DELETE CODE

DELETE FROM configuration WHERE configuration_key in ('SHOW_PRODUCT_IMAGELINK_ACCOUNT_HISTORY');

DELETE FROM configuration WHERE configuration_key in ('IMAGELINK_ACCOUNT_HISTORY_LINK_TYPE');

DELETE CODE

**includes/templates/YOUR_TEMPLATE/templates/tpl_account_history_info_default.php
**
replace this:
echo $order->products[$i]['name'];

with this:
// Twitch Base7 for 1.57c - Commercial
if (SHOW_PRODUCT_IMAGELINK_ACCOUNT_HISTORY == 'Show') {
// get product image
$reorder_image = zen_get_products_image($order->products[$i]['id'], IMAGE_SHOPPING_CART_WIDTH, IMAGE_SHOPPING_CART_HEIGHT); // Twitch Fast Image Lookup
// Get the status of a product
$get_prod_status = "SELECT products_status from " . TABLE_PRODUCTS . (zen_not_null($order->products[$i]['id']) ? " WHERE products_id=" . (int)$order->products[$i]['id'] : "");
$found_status = $db->Execute($get_prod_status);
$found_status->fields['products_status'];

if (zen_get_products_stock($order->products[$i]['id']) < 1 || $found_status->fields['products_status'] < 1) {
// do not show link to unavailable product
  echo $reorder_image.' '.$order->products[$i]['name'];

} else { // product in stock

if (IMAGELINK_ACCOUNT_HISTORY_LINK_TYPE == 'Reorder') { // Add to cart (click to reorder)
    echo '<a href="' . zen_href_link($_GET['main_page'], zen_get_all_get_params(array('action')) . 'action=cust_order&pid=' . $order->products[$i]['id']) . '">'.$reorder_image. $order->products[$i]['name'] .'</a></li><br>' . "\n" ;
} else { // Show product image, name and link (default)
    echo '<a href="' . zen_href_link(zen_get_info_page($order->products[$i]['id']), 'products_id=' . $order->products[$i]['id']) . '">' . $reorder_image.' '.$order->products[$i]['name'] . '</a>'; } }

} else { // stock
echo $order->products[$i]['name'];
}

Now the link will only show if product stock > 1 or** product status = ON
**

Twitch.
https://www.twitchtoo.com Do you work for free? Please donate.
June 7.2026 - NOW AVAILABLE - Twitch Base8 - Obsidian