Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need Some help to develop OsC Site


Anuruddha

Recommended Posts

Posted

I went to the site (crystallight.com) and it is great. I think it is one of successful site based on OSC. So I check the site for lerning purpose because I hope to develop the ecommerce site based on OSC.

 

So I like to know some contributions used in your site. I search for them in the OSC contribution section and forumn section. But unfortunately I coudn't find anything. So I list them in below.

 

1) Contributions used to make the Tab menu system with the pop up expand when we mouse over the menu Tab.

 

2) Contribution used to disable the Add to cart button in produce info page when the stock is out of order.

 

3) Contribution used to make select menu (drop down) for add product quantity in shopping cart instead of the text box.

 

If anyone can please send the url for those contributions.

 

 

-------------------

Anuruddha

Posted

OK, first off, that url isnt an osc site, and is run by kraft foods....? Maybe theres a typo, but i tried lots of variants and just got junk, but.....

 

OK, for the contributions, I found all 3 in about 30 seconds flat, so rather than post links, a little education on searching contribs:

 

Basically, do a brief description of what you want, and type it into search, so for your number 1, try "Tab menu popup", for 2, try "disable buy stock" and for 3 you could try "dropdown quantity add". If these dont work, try variants. Basically, if you know what you want, then it should be fairly easy to find it.

 

A little searching will pay big dividends, not least because you may stumble across other gems which you wouldn't otherwise have known about.

Posted

Hi tonystewart,

 

Thanks for your reply.

 

Sorry about the typo. Correct URL is http://www.crystallight.com.tw/

 

Again thanks for very good hints for searching the contributions.

 

------------------

Anuruddha

 

OK, first off, that url isnt an osc site, and is run by kraft foods....? Maybe theres a typo, but i tried lots of variants and just got junk, but.....

 

OK, for the contributions, I found all 3 in about 30 seconds flat, so rather than post links, a little education on searching contribs:

 

Basically, do a brief description of what you want, and type it into search, so for your number 1, try "Tab menu popup", for 2, try "disable buy stock" and for 3 you could try "dropdown quantity add". If these dont work, try variants. Basically, if you know what you want, then it should be fairly easy to find it.

 

A little searching will pay big dividends, not least because you may stumble across other gems which you wouldn't otherwise have known about.

Posted

you may want to ask amanda and read her posts/contributions.

Posted

Hi enigma1,

 

Thanks for reply.

 

I will see her posts.

 

----------------

Anuruddha

 

you may want to ask amanda and read her posts/contributions.
Posted
Hi enigma1,

 

Thanks for reply.

 

I will see her posts.

 

----------------

Anuruddha

 

 

well, in sequence:

 

1) tab popups

 

These are basically css popups.

I use the category tabs multi-row version but you can also incorporate this in the normal category tabs contribution.

 

a) in you css file you add the class for tabPopup:

 

a span.tabPopup {display: none;color:#ffffff}

a:hover span.tabPopup {display: block;background: transparent;position: absolute;left: 200px;top:128px;z-index: 5;}

 

(you have to experiment a little with the position numbers though)

 

B) you add a function to return the text based on the category number:

 

function tabtext ($counter) {

switch ($counter) {

case '1' : $t = 'text for cat 1';break;

case '2' : $t = 'text for cat 2';break;

case '3' : $t = 'text for cat 3';break;

case '4' : $t = 'text for cat 4';break;

}

return $t;

}

 

(you can ofcourse also use a query to retrieve text from the database if you have category description contributions installed)

 

c) you add a switch, handy if you wish to disable the popup on any condition or if you want to be able to control it later via admin.

 

$pop_enabled = true;

 

and the text format wrappers:

 

if ($pop_enabled) {

$width = 600;

$tp1 = '<span class="tabPopup"><table cellpadding="8" style="background:#6FBAF1;color:#FFFFFF;border:1px;border-style:solid;border-color:#6FBAF1 #d3d3d3 #d3d3d3 #d3d3d3;" width="' . $width . '"><tr><td align="center">';

$tp3 = '</td></tr></table><table border="0" width="' . $width . '" cellpadding="0"><tr><td><img src="images/box_bottom_s.jpg" border="0" width="100%" height="8px"></td></tr></table></span>';

}

 

 

d) then before creating the individual tab links you set the $tabPopCont variable:

 

$tabPopCont = '';

if ($pop_enabled) $tabPopCont = $tp1.tabtext($counter).$tp3;

 

and you create the link:

 

$categories_string .= '<a class="tabsOff" href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . $tabPopCont . $foo[$counter]['name'] . '</a></td>';

 

 

---------------------------------------------------------------------------------------------------------------

 

2) Buy Button switch on no-stock or no-price

 

a) make sure you always select the products_quantity field in your product queries. Normally that is only done if you selected in admin that you want to show the quantity. If you don't, it is not selected and as such you cannot use it in any condition.

 

b)in product_listing.php you have:

 

case 'PRODUCT_LIST_BUY_NOW':

$lc_align = 'center';

$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';

break;

 

which displays the button if enabled in admin.

 

you wrap that in a condition like :

 

case 'PRODUCT_LIST_BUY_NOW':

$lc_align = 'center';

if (($listing['products_quantity'] > 0) and ($listing['products_price'] > 0)) {

$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';

} else {

$lc_text = tep_image_button('button_buy_now_disabled.gif', '') . ' ';

}

break;

 

c) create a grayed button called button_buy_now_disabled.gif which will be shown when either the stock is smaller than 1 or the price is zero but without any link.

 

d) the same principle applies to the product_info page and other pages which display that button

 

 

----------------------------------------------------------------------------------------------------------

 

3) stock based dropdown in shopping_cart.php

 

a) just after the start of the product loop:

 

for ($i=0, $n=sizeof($products); $i<$n; $i++) {

if (($i/2) == floor($i/2)) {

$info_box_contents[] = array('params' => 'class="productListing-even"');

} else {

$info_box_contents[] = array('params' => 'class="productListing-odd"');

}

 

you add:

 

$max_to_order = tep_get_products_stock($products[$i]['id']);

$options = array();

if ($max_to_order > 0) {

for ($s=0 ; $s<$max_to_order; $s++) {

$z = $s+1;

$options[] = array('id' => $z,

'text' => $z);

}

} else {

$options[] = array('id' => 0,

'text' => 0);

}

 

this will just create an array from 1 to the stock level of that particular product.

if you have huge stock levels you may want to put a limit in there.

 

B) then you replace the normal input field:

 

 

$info_box_contents[$cur_row][] = array('align' => 'center',

'params' => 'class="productListing-data" valign="top"',

'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']));

 

 

with the dropdown field:

 

 

$info_box_contents[$cur_row][] = array('align' => 'right',

'params' => 'class="productListing-data" valign="top" nowrap',

'text' => tep_draw_pull_down_menu('cart_quantity[]', $options, $products[$i]['quantity'], '').tep_draw_hidden_field('products_id[]', $products[$i]['id']));

Treasurer MFC

Posted

Hi Amanda,

 

Thanks for your reply.

 

Thank you very much for posting the code. It will help me to add the code easily.

 

Thanks for your contributions and helping me. :D

 

-------------

Anuruddha

 

 

well, in sequence:

 

1) tab popups

 

These are basically css popups.

I use the category tabs multi-row version but you can also incorporate this in the normal category tabs contribution.

 

a) in you css file you add the class for tabPopup:

 

a span.tabPopup {display: none;color:#ffffff}

a:hover span.tabPopup {display: block;background: transparent;position: absolute;left: 200px;top:128px;z-index: 5;}

 

(you have to experiment a little with the position numbers though)

 

B) you add a function to return the text based on the category number:

 

function tabtext ($counter) {

switch ($counter) {

case '1' : $t = 'text for cat 1';break;

case '2' : $t = 'text for cat 2';break;

case '3' : $t = 'text for cat 3';break;

case '4' : $t = 'text for cat 4';break;

}

return $t;

}

 

(you can ofcourse also use a query to retrieve text from the database if you have category description contributions installed)

 

c) you add a switch, handy if you wish to disable the popup on any condition or if you want to be able to control it later via admin.

 

$pop_enabled = true;

 

and the text format wrappers:

 

if ($pop_enabled) {

$width = 600;

$tp1 = '<span class="tabPopup"><table cellpadding="8" style="background:#6FBAF1;color:#FFFFFF;border:1px;border-style:solid;border-color:#6FBAF1 #d3d3d3 #d3d3d3 #d3d3d3;" width="' . $width . '"><tr><td align="center">';

$tp3 = '</td></tr></table><table border="0" width="' . $width . '" cellpadding="0"><tr><td><img src="images/box_bottom_s.jpg" border="0" width="100%" height="8px"></td></tr></table></span>';

}

d) then before creating the individual tab links you set the $tabPopCont variable:

 

$tabPopCont = '';

if ($pop_enabled) $tabPopCont = $tp1.tabtext($counter).$tp3;

 

and you create the link:

 

$categories_string .= '<a class="tabsOff" href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . $tabPopCont . $foo[$counter]['name'] . '</a></td>';

---------------------------------------------------------------------------------------------------------------

 

2) Buy Button switch on no-stock or no-price

 

a) make sure you always select the products_quantity field in your product queries. Normally that is only done if you selected in admin that you want to show the quantity. If you don't, it is not selected and as such you cannot use it in any condition.

 

b)in product_listing.php you have:

 

case 'PRODUCT_LIST_BUY_NOW':

$lc_align = 'center';

$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';

break;

 

which displays the button if enabled in admin.

 

you wrap that in a condition like :

 

case 'PRODUCT_LIST_BUY_NOW':

$lc_align = 'center';

if (($listing['products_quantity'] > 0) and ($listing['products_price'] > 0)) {

$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';

} else {

$lc_text = tep_image_button('button_buy_now_disabled.gif', '') . ' ';

}

break;

 

c) create a grayed button called button_buy_now_disabled.gif which will be shown when either the stock is smaller than 1 or the price is zero but without any link.

 

d) the same principle applies to the product_info page and other pages which display that button

----------------------------------------------------------------------------------------------------------

 

3) stock based dropdown in shopping_cart.php

 

a) just after the start of the product loop:

 

for ($i=0, $n=sizeof($products); $i<$n; $i++) {

if (($i/2) == floor($i/2)) {

$info_box_contents[] = array('params' => 'class="productListing-even"');

} else {

$info_box_contents[] = array('params' => 'class="productListing-odd"');

}

 

you add:

 

$max_to_order = tep_get_products_stock($products[$i]['id']);

$options = array();

if ($max_to_order > 0) {

for ($s=0 ; $s<$max_to_order; $s++) {

$z = $s+1;

$options[] = array('id' => $z,

'text' => $z);

}

} else {

$options[] = array('id' => 0,

'text' => 0);

}

 

this will just create an array from 1 to the stock level of that particular product.

if you have huge stock levels you may want to put a limit in there.

 

B) then you replace the normal input field:

$info_box_contents[$cur_row][] = array('align' => 'center',

'params' => 'class="productListing-data" valign="top"',

'text' => tep_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="4"') . tep_draw_hidden_field('products_id[]', $products[$i]['id']));

with the dropdown field:

$info_box_contents[$cur_row][] = array('align' => 'right',

'params' => 'class="productListing-data" valign="top" nowrap',

'text' => tep_draw_pull_down_menu('cart_quantity[]', $options, $products[$i]['quantity'], '').tep_draw_hidden_field('products_id[]', $products[$i]['id']));

Archived

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

×
×
  • Create New...