Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How Can I Do This? Is it Even Possible?


Mort-lemur

Recommended Posts

Hi everyone,

 

I now have the "Exclude from Free Shipping" modification installed and running like a dream.

 

However, I need to be able to display an image or flag or some text on the product info pages for items that are excluded from free shipping.

 

Now I can do this manually on each product page, but it would seem more sensible to be able to call this image up automatically when a certain condition (in this case "exflag") is set to 1 and then remove it when the flag is set to 0.

 

Can anyone think how to do this? or point me to an example of something similar?

 

Im using 2.2 Rc2a

 

Many Thanks

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Link to comment
Share on other sites

Heather,

 

 

 

Yes it is possible, but you would have to set a condition in the categories.php file that would set the image on the product_info.php file when the flag is positive. This would also require an additional field in the products table of the database.

 

 

 

 

Chris

Link to comment
Share on other sites

Thanks Chris,

 

The additional field "exclude from free shipping" is already added to the product table during the mod.

 

So could I just add a condition to product_info along the lines of if exflag=1 then echo image.jpg ??

 

I would need to research the correct format of a condition statement and also on how to place the image where I wnted it.

 

Thanks

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Link to comment
Share on other sites

Hi Chris,

 

Thanks for yor patience

 

I have modified the code of product_info.php to read:

 

    if (tep_not_null($product_info['products_model'])) {
     $products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';
   } else {
     $products_name = $product_info['products_name'];
   }
   // added for Exclude from Free Shipping Icon 
   if ($products['exclude_free_shipping'] == '1') {
    $img_new_product = tep_image_button('icon_newarrival.gif', TEXT_ICON_NEW_PRODUCT . ' : ' . $product_info['products_name']);
   }
   // end addition for New Product Icon contribution	
?>

 

(Im using the same image etc as the contribution until I get this to work. - I have also modified the query to include

p.exclude_free_shipping

and uploaded the image to the correct folder...

 

Still nothing shows when I exclude an item from free shipping

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Link to comment
Share on other sites

Two days later and I still cant get this to work, grrr!

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Link to comment
Share on other sites

(Im using the same image etc as the contribution until I get this to work. - I have also modified the query to include

p.exclude_free_shipping

and uploaded the image to the correct folder...

 

Still nothing shows when I exclude an item from free shipping

Do you mean the $product_info_query? If so try

   // added for Exclude from Free Shipping Icon
   if ($product_info['exclude_free_shipping'] == '1') {
     $img_new_product = tep_image_button('icon_newarrival.gif', TEXT_ICON_NEW_PRODUCT . ' : ' . $product_info['products_name']);
   } else {
     $img_new_product = '';
   }
   // end addition for New Product Icon contribution   

You do know the tep_image_button function is looking for your image in includes/languages/your_language/images/buttons folder, right?

Link to comment
Share on other sites

Hi Brian,

 

Yes the image is in the right place, and the fields in the database are set to 1.

 

But your code does not show the image either.

 

This is very odd.........

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Link to comment
Share on other sites

Im Proud of myself - Sorted it!

 

Had to also include some code at the right place to call up the image - I chose at the bottom, just above the add to cart button :

 

      <tr>
       <td class="main"><?php echo TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; ?></td>
	 </tr>
<?php
// BOF Exclude from Free Shipping Image	 
?>
 <tr>
     <td align="right" valign="bottom"><?php echo $img_new_product; ?></td>
	</tr> 
<?php
// EOF Exclude from Free Shipping Image	 
?>		

 

Now all I need to do is find out how to exclude all products by category level from free shipping and I will be happy - any suggestions where to start ??

 

Thanks

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Link to comment
Share on other sites

Had to also include some code at the right place to call up the image

Sorry I assumed that was in place.

 

Now all I need to do is find out how to exclude all products by category level from free shipping and I will be happy - any suggestions where to start ??

Not sure but I think there is an add on that gives free shipping by category. Maybe that can give a guide on what to do.

Link to comment
Share on other sites

Hi,

 

The way I am thinking of doing this is:

 

1) Add a new column to the categories table: cat_exclude_free_shipping

 

2) In admin/categories.php add some code to the existing exclude free shipping by product (as an else statement?) to exclude free shipping if the cat_exclude_free_shipping value = 1

 

 

3) add an elseif statement in product_info.php to show the excluded image image if the items category cat_exclude_free_shipping value = 1

 

How does that sound so far ???

 

Then somehow mirror the product red/green buttons for the categories.

 

(Im not shy from accepting help on this)

 

Many Thanks

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Link to comment
Share on other sites

Hi,

 

How does this look for the admin/categories.php

 

  ///////// BOF exclude products from free shipping total V 1.0 /////////
?>

               <td class="dataTableContent" align="center">
<?php
      if ($products['exclude_free_shipping'] == '1') {
       echo tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ICON_EXCLUDED_FROM_FREE_SHIPPING, 10, 10) . '  
       <a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=set_free_shipping&exflag=0&pID=' . $products['products_id'] . '&cPath=' . $cPath) . '">' . 
       tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', IMAGE_ICON_INCLUDE_FOR_FREE_SHIPPING, 10, 10) . '</a>';
// BOF exclude categories from free shipping total
  } elseif {
($products['cat_exclude_free_shipping'] == '1') {
       echo tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ICON_EXCLUDED_FROM_FREE_SHIPPING, 10, 10) . '  
       <a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=set_free_shipping&exflag=0&pID=' . $products['products_id'] . '&cPath=' . $cPath) . '">' . 
       tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', IMAGE_ICON_INCLUDE_FOR_FREE_SHIPPING, 10, 10) . '</a>';	  
// EOF exclude categories from free shipping total	
     } else {
       echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=set_free_shipping&exflag=1&pID=' . $products['products_id'] . '&cPath=' . $cPath) . '">' . 
       tep_image(DIR_WS_IMAGES . 'icon_status_green_light.gif', IMAGE_ICON_EXCLUDE_FROM_FREE_SHIPPING, 10, 10) . '</a>
         ' . tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_ICON_INCLUDED_FOR_FREE_SHIPPING, 10, 10);
     } 

?></td></tr>

<?php

   ///////// EOF exclude products from free shipping total V 1.0 /////////  
?>			  

 

Thanks

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Link to comment
Share on other sites

Nope, The above is wrong, and its starting to fry my simple brain now....

 

What Im trying to do is set the value of a new field in the database cat_exclude_free_shipping using red / green buttons on the admin page.

 

Then use this to set the product database field exclude_free_shipping to match this value for all products in that category.

 

Then the logic of the existing exclude products from free shipping should kick in and do all the calculations etc.

 

any help ?

 

Thanks

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Link to comment
Share on other sites

OK

 

I think I may be overcomplicating this??

 

What Im looking for is s simple statement that says if category table field = 1 then make products within that category fields = 1 if not then do nothing.

 

I can then change the category field value by adding an extra input field to the category edit area.

 

Thinking about how to do this is disturbing my sleep now !! Grrrr

Now running on a fully modded, Mobile Friendly 2.3.4 Store with the Excellent MTS installed - See my profile for the mods installed ..... So much thanks for all the help given along the way by forum members.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...