Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to add a link on product info page


shokt

Recommended Posts

Hi all,

 

I want to add a link on Product_info.php page.. which only appear on a single particular sub-category not on all

Example:

 

My categories & sub-categories are :

 

 

Ladies Wear->

Accessories

Casual Wear

Churidar Suits

Footwear

Hair Piece

Kurties

Lehnga

Make To Measure

Salwar Suits

Sarara Suits

Saree

Trouser Suits

Winter Collection

Mens Wear->

 

 

Like Ladies wear is my category and under it are my sub-categories.

ON one sub-category "Make to measure" I want a link to appear.. I only want that link to appear on "Make to measure" not on all categories/sub-categories.

 

Any advice please ?

would be grateful for any help

 

Thanks in advance

Link to comment
Share on other sites

Determine the category id for the category that you want to add the link to. With that you can add a conditional to display it only when that category is selected. Put the code where you want the link.

 

If you cannot figure that out then post the category id, the link name and url that you want and someone will likely post it here for you.

Community Bootstrap Edition, Edge

 

Avoid the most asked question. See How to Secure My Site and How do I...?

Link to comment
Share on other sites

Determine the category id for the category that you want to add the link to. With that you can add a conditional to display it only when that category is selected. Put the code where you want the link.

 

If you cannot figure that out then post the category id, the link name and url that you want and someone will likely post it here for you.

 

Thank YOU Mark for reply,

can you please help with that conditional querry ?

as sub-category Id = 47_78

 

For now, I'm trying it on localhost for learning purpose.

 

sub category on which products i want the link to appear (i want the link to appear only at this sub category's product info.php page not on all sub-categories product info page)

localhost/mansi/shop/index.php/cPath/47_78

 

Product Info page where i want the link to appear

localhost/mansi/shop/product_info.php?cPath=47_78&products_id=908

 

Can you please help me with the custom query ?

 

I would be so grateful for any help.. :)

 

Thanks you again.. :rolleyes: :rolleyes:

Link to comment
Share on other sites

Add the link as part of the description in the admin section. In other words go to your admin section, open up the category or product description you want the link to appear and add the link there.

 

 

If you want the link to appear elsewhere on the page other than in the category or product description , then add this to the category or product description in your admin:

 

<?php $link='the html of your link'; ?>

 

(note - the ; is important)

 

Then any where you want the link to appear, as long as it is below the description on product_info.php add this:

 

<?php $link ?>

 

the 'html of your link' is my shorthand for your actual link enclosed in quotes.

 

The only other thing you are going to have to be careful about is the <?php and ?> tags. You can't duplicate them within existing <?php and ?> tags. However

$link

will display your link as long as it is within any existing <?php and ?> tags.

Oscommerce site:

 

 

OSC to CSS, http://addons.oscommerce.com/info/7263 -Mail Manager, http://addons.oscommerce.com/info/8120

Link to comment
Share on other sites

This example will place a link back to your home page using the products name as the link name.

You need to first get category/subcategory id and add it to the $product_info_query. Add to the select part right before it says from

, p2c.categories_id

Add to the from part right before it says where

, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c

Add to the where part

and p2c.products_id = p.products_id

The stock osc query will now look like this

   $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id, p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and p2c.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

Then if you were to put lets say after the date available section you would so like this. Change the nember 4 to your category/subcategory id.

<?php
   if ($product_info['categories_id'] == '4') {
?>
     <tr>
       <td align="center" class="smallText"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . $product_info['products_name'] . '</a>'; ?></td>
     </tr>
<?php
   }
?>

Link to comment
Share on other sites

Why overcomplicate? Use $current_category_id to get the "current category id"...but do you need that anyway????

 

As I am unsure as to what it is that you want exactly. Do you want a link on a particular product info 908, if the current category id is 78?

 

All you need to do is this;

 

<?php if ($product_info['products_id'] == 908) echo "whatever"; ?>

 

How else can 908 be shown? Whenever it is shown current_category_id -should- always default 78 anyway!

Link to comment
Share on other sites

Why overcomplicate? Use $current_category_id to get the "current category id"...but do you need that anyway????

 

As I am unsure as to what it is that you want exactly. Do you want a link on a particular product info 908, if the current category id is 78?

 

All you need to do is this;

 

<?php if ($product_info['products_id'] == 908) echo "whatever"; ?>

 

How else can 908 be shown? Whenever it is shown current_category_id -should- always default 78 anyway!

 

 

Thank you every one for replying :D

 

AT BURT:

Special Thanks to you

You said right... why over complicate. and it is solved as per your suggestion

*Appreciations+*

 

Thank you everyone :rolleyes:

Link to comment
Share on other sites

Why overcomplicate? Use $current_category_id to get the "current category id"...but do you need that anyway????

 

As I am unsure as to what it is that you want exactly. Do you want a link on a particular product info 908, if the current category id is 78?

 

All you need to do is this;

 

<?php if ($product_info['products_id'] == 908) echo "whatever"; ?>

 

How else can 908 be shown? Whenever it is shown current_category_id -should- always default 78 anyway!

 

 

This query works absolutely fine where the product_id == 908

 

But I want the link appear on a particular category not on particular product

 

Can you please let me know how to make this appear on a particular sub-category... like in the Link

 

localhost/mansi/shop/product_info.php/cPath/47_78/products_id/908

 

I want the link appear where categories_id == 47_78

I want to associate that query with the categories_id not with product_id

 

Can you please help ?

 

Thank you

Link to comment
Share on other sites

if ($current_category_id == 78) echo "whatever";

 

This:

localhost/mansi/shop/product_info.php/cPath/47_78/products_id/908

is a product page.

 

This:

localhost/mansi/shop/index.php/cPath/47_78

is a cateogry page

 

Please be more specific.

Link to comment
Share on other sites

if ($current_category_id == 78) echo "whatever";

 

This:

localhost/mansi/shop/product_info.php/cPath/47_78/products_id/908

is a product page.

 

This:

localhost/mansi/shop/index.php/cPath/47_78

is a cateogry page

 

Please be more specific.

 

Yes

 

localhost/mansi/shop/index.php/cPath/47_78

This is the sub-category page. but i dont want the link to appear at this page.

 

localhost/mansi/shop/product_info.php/cPath/47_78/products_id/908

 

This is the product_info page. I want the link to appear on product_info page where category is 47_78

 

Thank you again for the quick response. i hope i explain the problem clearly...

 

:)

Link to comment
Share on other sites

Why overcomplicate? Use $current_category_id to get the "current category id"...but do you need that anyway????

 

As I am unsure as to what it is that you want exactly. Do you want a link on a particular product info 908, if the current category id is 78?

 

All you need to do is this;

 

<?php if ($product_info['products_id'] == 908) echo "whatever"; ?>

 

How else can 908 be shown? Whenever it is shown current_category_id -should- always default 78 anyway!

Thanks Burt. I did not realize the $current_category_id was available like that if it was not sent as part of the url. I will remember that for next time.

 

Thanks

Brian

Link to comment
Share on other sites

Thanks Burt. I did not realize the $current_category_id was available like that if it was not sent as part of the url. I will remember that for next time.

 

Thanks

Brian

 

Yes, I agree that Burt told a good way..

 

but i wonder if for doing that.........

 

Do i need to join the tables in the query to get required result ?

 

or any other suggestions please ?

 

Thank you

Link to comment
Share on other sites

Yes, I agree that Burt told a good way..

 

but i wonder if for doing that.........

 

Do i need to join the tables in the query to get required result ?

 

or any other suggestions please ?

 

Thank you

No you don't. I failed to realize that the current category id was already being set in application_top.php. That's my bad.

 

All you need is what Burt said

 

if ($current_category_id == 78) echo "whatever";

Link to comment
Share on other sites

No you don't. I failed to realize that the current category id was already being set in application_top.php. That's my bad.

 

All you need is what Burt said

 

if ($current_category_id == 78) echo "whatever";

 

What I'm looking for is that link appear on Product_info.php not on category page..

Like i explain above

 

localhost/mansi/shop/index.php/cPath/47_78

Above is the sub-category page. but i dont want the link to appear at this page.

 

Quote

localhost/mansi/shop/product_info.php/cPath/47_78/products_id/908

Above is the product_info page. I want the link to appear on product_info page where sub-category is 47_78

 

I dont want the link to appear for a product_id == 908

 

But i want the link to appear on product_info.php page for all products under sub-category 47_78

 

Thank you again for the quick response. i hope i explain the problem clearly... :rolleyes:

Link to comment
Share on other sites

Add this:

 

if ($current_category_id == 78) echo "whatever";

 

to the product_info.php page !!!

 

Why are you not trying the things that we are telling to you?

 

 

Thank you burt

I tried it for product_id , category_id and category name..

 

I just want to learn that by experience and you're indeed so much helpful to me.. and you're so kind.

I learn from you alot...

 

The problems are already solved.. I will disturb you again for another problems... ;)

 

Thank you again to everyone who responded

 

:rolleyes:

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...