Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Featured 1.5


defender39

Recommended Posts

You would need to use tep_draw_form as the 'add_product' parameter will the look for POSTed items, as opposed to the buy_now which uses GET. Look at the code on the product_info.php page and copy and paste it into where previously suggested above.

"Any fool can know. The point is to understand." -- Albert Einstein

Link to comment
Share on other sites

  • Replies 94
  • Created
  • Last Reply

Top Posters In This Topic

try this..I got it to work

 

 $info_box_contents[$row][$col] = array('align' => 'center',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'params' => 'class="smallText" width="33%" valign="bottom"',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . $featured_products['products_name'] . '</a><br><s>' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . 
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?$currencies->display_price($featured_products['specials_new_products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</span>' . '<br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $featured_products['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>');
? } else {
? ? $info_box_contents[$row][$col] = array('align' => 'center',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'params' => 'class="smallText" width="33%" valign="bottom"',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . $featured_products['products_name'] . '</a><br>' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '<br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $featured_products['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>');
? }

Edited by defender39
Link to comment
Share on other sites

Well this is getting even more complicated.

I just ran a test and I have many products that have color options and such.

 

Is there a way to also have it check for those options and make that selection available in the shopping cart also .. like duplicate the drop down on the product page for that product id "attributes".

 

Continue will proceded as if they were on the product page ... err this is tricky.

 

If I can't do that .. then this is a wash for me.

I need to have the options selection "product attributes" in the shopping cart as well.

 

Ohh I am not much of a programmer, but this sounds like a PITA.

Edited by ScooterProShop.com

Scooterboy

Link to comment
Share on other sites

Jesse

 

what bit of code did you change to make it different from what I had originally posted

 

cheers

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

Sorry but thats a bit too much time for me to try getting that to work.

 

BTW- Your site is looking much better and obviously you can see a difference in the image quality with the jpegs. Nice Free Shipping in the header... try a better buy_now button like this one

http://www.toytokyo.com/includes/languages...ton_buy_now.gif

 

 

You can get this button pack in the contribs and it has a PNG template too.

http://www.oscommerce.com/community/contributions,1759

 

Some other suggestions...get rid of the search..you have only about 25 products so whats the point.

 

In your header_navigation you have an extra character after CHECKOUT...remove it..its in /include/header.php

 

You might want to play around a little with the fonts...color, size, style..see if you can spice it up some.

 

Consider getting rid of the Whats_new box..personally I think its a bit redundant since you have a featured page already. You dont need that box at all...most of us dont.

 

Install the PDF catalog. Your product would look nice in a pdf for someone to consider later. The Printable Catalog is not as well laid out and PDF are easier to email friends or to keep on your desktop as a file.

 

Your footer text (date and visits) is white..change that..it cant be seen on that background.

 

All in all...GREAT job.

Edited by defender39
Link to comment
Share on other sites

action=buy_now&products_id=

 

Yep that is what I had in my original post

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

Yes thant is what was getting me as well it worked sometimes and others as your jumps to product info

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

You can see it in action here Test Site

if you click on a buy now on the catalog page you get product_info but if you click on a buy now in the Bead Specials2 you get the shopping_cart this is a very basic site layout is per client instructions, however there has been a bit of modification to the codes

Edited by 241

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

looks to me like we have found an actual BUY NOW bug in OSC.

 

Look here..

you can buy now certain products just fine...but some refuse...I am not sure why yet...maybe this has even been reported.

 

http://www.videogamedeals.com/product_info...roducts_id/1375

 

the product above refuses to BUYNOW...do a search for analog and you will see that it just wont budge...other products also seem to create this problem. It could be an attributes issue but I do see some products with attributes actually work just fine.

 

Does anyone know about this bug or why it would behave in such a way?

Link to comment
Share on other sites

It's because if a product has attributes available with the product it will automatically redirect you to product_info.php, but if the product has no attributes then it will be automatically added to the cart. Have a read of application_top.php. Tied up right now otherwise I would get my mind into it more to help.

"Any fool can know. The point is to understand." -- Albert Einstein

Link to comment
Share on other sites

So is there actually no way to get a BUY NOW button to add a product to the cart from the featured products on the main page?

 

There has got to be a script error of some sort causing this behavior.

I don't think this is an actual bug, I think it is more/less an error in the code somewhere. I am not a programmer so my ability to sift through the code is nill to null. I will keep playing with the code to see if I can get it working also.

 

The code will have to include the product attribute options as well.

 

This will be tough. heh?

Scooterboy

Link to comment
Share on other sites

You wouldn't want to force the attributes for a product, it is up to the customer to decide what color, size, type etc they want. You could do a check to see if a product has attributes, and display a but now button if it doesn't but that might look a bit uphazard, unless you stick a button saying more info, for those that do have selectable attributes.

 

Heres the code that is governing the buy_now and add_product parameters

// customer adds a product from the products page
case 'add_product' :
if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
 $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);
}
tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
break;

// performed by the 'buy now' button in product listings and review page
case 'buy_now' :
if (isset($HTTP_GET_VARS['products_id'])) {
if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
} else {
 $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1);
}
}
tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
break;

I now see that on the test site shown above that in actual fact the attributes to those items are shipping options ? And leads to the possibility of having each item being requested to be sent by different carriers (all to the same address?).

"Any fool can know. The point is to understand." -- Albert Einstein

Link to comment
Share on other sites

And the same on my site.

When you go to buy a Main product it has attributes for the customer to select.

Perhaps it is better to leave it the way it is then.

 

When I go to buy a product on my site (parts) that does not have attributes, it goes to shopping cart as it should.

 

I am happy the way the code is. Agreed?

 

Here is the code I have:

<?php
/*
?osCommerce, Open Source E-Commerce Solutions
?http://www.oscommerce.com

?Copyright (c) 2002 osCommerce

?Released under the GNU General Public License
?
?Featured Products V1.5 - Updated w/buy now - add to cart
?Displays a list of featured products, selected from admin
?For use as an Infobox instead of the "New Products" Infobox ?
*/
?>
<!-- featured_products //-->
<?php
if(FEATURED_PRODUCTS_DISPLAY == 'true')
{
?$featured_products_category_id = $new_products_category_id;
?$cat_name_query = tep_db_query("select categories_name from categories_description where categories_id = '" . $featured_products_category_id . "' limit 1");
?$cat_name_fetch = tep_db_fetch_array($cat_name_query);
?$cat_name = $cat_name_fetch['categories_name'];
?$info_box_contents = array();

?if ( (!isset($featured_products_category_id)) || ($featured_products_category_id == '0') ) {
? ?$info_box_contents[] = array('align' => 'left', 'text' => '<a class="headerNavigation" href="' . tep_href_link(FILENAME_SPECIALS) . '">' . TABLE_HEADING_FEATURED_PRODUCTS . '</a>');

?list($usec, $sec) = explode(' ', microtime());
?srand( (float) $sec + ((float) $usec * 100000) );
?$mtm= rand();

? ?$featured_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where p.products_status = '1' and f.status = '1' order by rand($mtm) DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS);
?} else {
? ?$info_box_contents[] = array('align' => 'left', 'text' => sprintf(TABLE_HEADING_FEATURED_PRODUCTS_CATEGORY, $cat_name));
? ?$featured_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . $featured_products_category_id . "' and p.products_status = '1' and f.status = '1' order by rand() DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS);
?}

?$row = 0;
?$col = 0; 
?$num = 0;
?while ($featured_products = tep_db_fetch_array($featured_products_query)) {
? ?$num ++; if ($num == 1) { new contentBoxHeading($info_box_contents); }
? ?$featured_products['products_name'] = tep_get_products_name($featured_products['products_id']);
? ?if($featured_products['specstat']) {
? ? ?//$info_box_contents[$row][$col] = array('align' => 'center',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //'params' => 'class="smallText" width="33%" valign="bottom"',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . $featured_products['products_name'] . '</a><br><s>' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . 
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? //$currencies->display_price($featured_products['specials_new_products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</span>' . '<br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $featured_products['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>');
?} else {
? ?$info_box_contents[$row][$col] = array('align' => 'center',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'params' => 'class="smallText" width="33%" valign="bottom"',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . $featured_products['products_name'] . '</a><br>' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '<br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $featured_products['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>');
?}
? ?$col ++;
? ?if ($col > 2) {
? ? ?$col = 0;
? ? ?$row ++;
? ?}
?}
?if($num) {
? ? ?
? ? ?new contentBox($info_box_contents);
?}
} else // If it's disabled, then include the original New Products box
{
? include (DIR_WS_MODULES . FILENAME_NEW_PRODUCTS);
}
?>
<!-- featured_products_eof //-->

 

The way I see it, is that this code is suitable for buyer needs and will be compatible amoung all markets, making this contrib that much better.

Edited by ScooterProShop.com

Scooterboy

Link to comment
Share on other sites

I now see that on the test site shown above that in actual fact the attributes to those items are shipping options ? And leads to the possibility of having each item being requested to be sent by different carriers (all to the same address?).

Does this make things harder or easier the client want to cut down on the number of stages that has to be gone through, in my own opinion this could be left for checkout time negating the attribute box

Edited by 241

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

I would of thought so, plus normally the customer would be displayed a list of shipping options which have calculated weights etc... so asking them to repeatively select which shipper to use might seem a bit frustrating and confusing, especially if the customer is not familar with your whole checkout process, I only got a far as login. What I think could be an answer is the Ship in Cart contrib. This I think displays the shipping options when the customer views the cart, at least that is what I assume the contrib is for.

"Any fool can know. The point is to understand." -- Albert Einstein

Link to comment
Share on other sites

yes i agree and have allready put several suggestions to the client as at the end of the day it is not my shop.

 

This contribution is an excellent addition and I have allready earmarked it for some mods for other things

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

OK...

 

so I dont want that attributes to disturb my buy it now so I found the function inside application_top

 

// performed by the 'buy now' button in product listings and review page
     case 'buy_now' :        if (isset($HTTP_GET_VARS['products_id'])) {
//buynow without attr             if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
//buynow without attr             tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
//buynow without attr             } else {
                                 $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1);
//buynow without attr                                 }
                             }

 

I am MS1 so I do not know if MS2 application_top is different. As you can see I commented out the lines I dont want. It works perfect now. Also note: I dont display my attributes as options. I display them as text for my site. I display them as ADDITIONAL FEATURES:

http://www.videogamedeals.com/product_info...roducts_id/1168

 

I also changed in my admin the ability to add the features in categories.php so when I add a product I just select the features it has. This way I can designate what attributes/featurs are available and I can enter them quick in admin. Such as condition, color, size and such. For me attributes which are extras are not important at all.

Link to comment
Share on other sites

Ok here is the next step.

Getting the Code to work for items on "special".

 

The code I have is working great [in my previous post].

This I am told needs to be added to a seperate file for items on special.

 

Anyone care to takle this one? What code and Where do I put it?

 

I think this code:

'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . $featured_products['products_name'] . '</a><br>' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '<br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $featured_products['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>');

 

But am not sure what file to put it in, or where it goes.

Edited by ScooterProShop.com

Scooterboy

Link to comment
Share on other sites

where and what in the includes/modules/featured.php code could be used to display the product description below the image.

 

I presume the code goes in here

. $featured_products['products_image'], $featured_products['products_name'],

 

would this be $product_description['product_description'] and if so what query is required

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

SCOOTERBOY

 

what are you trying to achieve the same look for specials as for featured on the front page

image with link

product name with link

special price

price

buy now button with link

 

if so is the code not allready written to take care of specials, if a product is on special and is featured on the front page it should show up in the same feel as other products but have the strike through text

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

It does, but no BUY NOW button.

I was told in a previous post that this code may have to added elsewhere.

 

Currently if a product is on special it has no Buy Now button.

I would like to show the BUY NOW button on the products on special also.

Edited by ScooterProShop.com

Scooterboy

Link to comment
Share on other sites

catalog/includes/modules/featured.php

 

if($featured_products['specstat']) {
     $info_box_contents[$row][$col] = array('align' => 'center',
                                          'params' => 'class="smallText" width="33%" valign="top"',
                                          'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . $featured_products['products_name'] . '</a><br><s>' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . 
                                          $currencies->display_price($featured_products['specials_new_products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</span>' . '<br><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $featured_products['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>');
   } else {

No longer giving free advice. Please place deposit in meter slot provided.  Individual: [=] SME: [==] Corporation: [===]
If deposit does not fit one of the slots provided then you are asking too much! :P

Is your Osc dated try Phoenix  raising oscommerce from the ashes.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...