Forums / General Questions / Made Duplicate Link Copy of Product to another sub category shows 0 couts.

Made Duplicate Link Copy of Product to another sub category shows 0 couts.

Started by wmorris on 12 Feb 2013, 4:08 PM · Views: 1,142

Results 1 to 14 of 14
12 Feb 2013, 4:08 PM
#1
wmorris avatar

wmorris

Totally Zenned

Join Date:
Aug 2007
Location:
Amarillo, Tx
Posts:
1,683
Plugin Contributions:
0

Made Duplicate Link Copy of Product to another sub category shows 0 couts.

I have made a duplicate link of a product into another sub category and there is only one product and it shows 0 products in that sub category.

12 Feb 2013, 5:39 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Made Duplicate Link Copy of Product to another sub category shows 0 couts.

Where does it show 0 products?

Does the Product show in the original Category?

If you look at the products_id in your Zen Cart Admin, is that the same products_id that you have in the other Category?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

12 Feb 2013, 5:59 PM
#3
wmorris avatar

wmorris

Totally Zenned

Join Date:
Aug 2007
Location:
Amarillo, Tx
Posts:
1,683
Plugin Contributions:
0

Re: Made Duplicate Link Copy of Product to another sub category shows 0 couts.

Hi Linda,

Yes, the original product is shown in the original sub category here: Bed, Bath & Body>Bath Decor>

http://www.morrisgiftshop.com/index.php?main_page=product_info&cPath=78_81&products_id=739

Then I made a duplicate link copy of the produt here: Furniture & Decor>Cabinets>

Here is the link of the Sub Category for Furniture & Decor

http://www.morrisgiftshop.com/index.php?main_page=index&cPath=138

There it shows 0 but there is that item that was duplicated from another sub category.

12 Feb 2013, 6:04 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Made Duplicate Link Copy of Product to another sub category shows 0 couts.

You have customized your code to show the number of Products, from what I can see ...

Where did you customize the code and what does it read to obtain the Product Count for the Categories?

I am thinking that perhaps you have a boo boo as clicking on the Category does work ... :lookaroun

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

12 Feb 2013, 6:12 PM
#5
wmorris avatar

wmorris

Totally Zenned

Join Date:
Aug 2007
Location:
Amarillo, Tx
Posts:
1,683
Plugin Contributions:
0

Re: Made Duplicate Link Copy of Product to another sub category shows 0 couts.

Ok,,, here is my Category and Sub Category file

includes/modules/category_row.php

<?php
/**
* index category_row.php
*
* Prepares the content for displaying a category's sub-category listing in grid format. 
* Once the data is prepared, it calls the standard tpl_list_box_content template for display.
*
* @package page
* @copyright Copyright 2003-2006 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: category_row.php 4084 2006-08-06 23:59:36Z drbyte $
*/
if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
}
$title = '';
$num_categories = $categories->RecordCount();

$row = 0;
$col = 0;
$list_box_contents = '';
if ($num_categories > 0) {
if ($num_categories < MAX_DISPLAY_CATEGORIES_PER_ROW || MAX_DISPLAY_CATEGORIES_PER_ROW == 0) {
$col_width = floor(100/$num_categories);
} else {
$col_width = floor(100/MAX_DISPLAY_CATEGORIES_PER_ROW);
}

while (!$categories->EOF) {
if (!$categories->fields['categories_image']) !$categories->fields['categories_image'] = 'pixel_trans.gif';
$cPath_new = zen_get_path($categories->fields['categories_id']);

// strip out 0_ from top level cats
$cPath_new = str_replace('=0_', '=', $cPath_new);

// explode the path to extract number of levels in category tree
$fullCatID= explode("_",$cPath_new);
// take the final level because it is the category whose contents are being displayed at current time
$myCatID = $fullCatID[sizeof($fullCatID)-1];

// fixer for when category is empty and not filled with subcategories
// check to see if myCatID is a parent category
$parentCheckQuery = "select parent_id from " . TABLE_CATEGORIES . " 
where parent_id = '".$myCatID."'";

$check_parent = $db->Execute($parentCheckQuery);
if ($check_parent->RecordCount() > 0) {
// it is a parent, so do not show total here
$countContent = '';

} else {

// $categories->fields['products_name'] = zen_get_products_name($categories->fields['products_id']);
$catQuery = "select products_id from " . TABLE_PRODUCTS . " 
where master_categories_id = '".$myCatID."'";

$check_categories = $db->Execute($catQuery);
if ($check_categories->RecordCount() > 0) {
// create number of items in category here
$recordCount = $check_categories->RecordCount();
$countContent = CATEGORIES_COUNT_PREFIX . $recordCount . CATEGORIES_COUNT_SUFFIX;
} else {$countContent = CATEGORIES_COUNT_PREFIX . '0' . CATEGORIES_COUNT_SUFFIX;}
} // end else of parent check



$list_box_contents[$row][$col] = array('params' => 'class="categoryListBoxContents"' . ' ' . 'style="width:' . $col_width . '%;"',
'text' => '<a href="' . zen_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . zen_image(DIR_WS_IMAGES . $categories->fields['categories_image'], $categories->fields['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br />' . $categories->fields['categories_name'].' '.$countContent.'</a>');

$col ++;
if ($col > (MAX_DISPLAY_CATEGORIES_PER_ROW -1)) {
$col = 0;
$row ++;
}
$categories->MoveNext();
}
}
?>
12 Feb 2013, 6:39 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Made Duplicate Link Copy of Product to another sub category shows 0 couts.

What happens if instead of all that code to figure out the count you use:

$countContent = zen_count_products_in_category($categories->fields['categories_id']);

Does $countContent now hold the right value?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

12 Feb 2013, 6:45 PM
#7
wmorris avatar

wmorris

Totally Zenned

Join Date:
Aug 2007
Location:
Amarillo, Tx
Posts:
1,683
Plugin Contributions:
0

Re: Made Duplicate Link Copy of Product to another sub category shows 0 couts.

I don't understand what you are getting at, Linda. Is that an extra line to put in with the code?

12 Feb 2013, 6:55 PM
#8
wmorris avatar

wmorris

Totally Zenned

Join Date:
Aug 2007
Location:
Amarillo, Tx
Posts:
1,683
Plugin Contributions:
0

Re: Made Duplicate Link Copy of Product to another sub category shows 0 couts.

Lind,

are you saying to chage this line:

$categories->fields['products_name'] = zen_get_products_name($categories->fields['products_id']);

to

$countContent = zen_count_products_in_category($categories->fields['categories_id']);
12 Feb 2013, 7:12 PM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Made Duplicate Link Copy of Product to another sub category shows 0 couts.

I used this code as the only change to that file:

 [B]   $countContent = zen_count_products_in_category($categories->fields['categories_id']);[/B]
    $list_box_contents[$row][$col] = array('params' => 'class="categoryListBoxContents"' . ' ' . 'style="width:' . $col_width . '%;"',
                                           'text' => '<a href="' . zen_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . zen_image(DIR_WS_IMAGES . $categories->fields['categories_image'], $categories->fields['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br />' . $categories->fields['categories_name'][B] . ' ' . $countContent .[/B] '</a>');

NOTE: You can fool with parens and stuff to make it pretty ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

12 Feb 2013, 7:17 PM
#10
wmorris avatar

wmorris

Totally Zenned

Join Date:
Aug 2007
Location:
Amarillo, Tx
Posts:
1,683
Plugin Contributions:
0

Re: Made Duplicate Link Copy of Product to another sub category shows 0 couts.

I like it but, I rather have this (#).

12 Feb 2013, 7:38 PM
#11
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Made Duplicate Link Copy of Product to another sub category shows 0 couts.

So customize the code ... :cool:

$countContent = [B]'(&nsbp;' . [/B]zen_count_products_in_category($categories->fields['categories_id'])[B] . '&nsbp;)'[/B];

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

12 Feb 2013, 8:56 PM
#12
wmorris avatar

wmorris

Totally Zenned

Join Date:
Aug 2007
Location:
Amarillo, Tx
Posts:
1,683
Plugin Contributions:
0

Re: Made Duplicate Link Copy of Product to another sub category shows 0 couts.

Linda,

when I change the code its doing this "Cabinets (&nsbp;1&nsbp;)"

12 Feb 2013, 8:59 PM
#13
wmorris avatar

wmorris

Totally Zenned

Join Date:
Aug 2007
Location:
Amarillo, Tx
Posts:
1,683
Plugin Contributions:
0

Re: Made Duplicate Link Copy of Product to another sub category shows 0 couts.

Nevermind I got fixed.

13 Feb 2013, 2:15 AM
#14
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Made Duplicate Link Copy of Product to another sub category shows 0 couts.

Thanks for the update that this is now working for you ... :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!