Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Master Products - MS2


Guest

Recommended Posts

Quantity Text Box:

 

Edit file: includes->modules-master_listing.php

locate switch satement:

              case 'MASTER_LIST_BUY_NOW':

           

This is where quantity is built. You have three options in here controled by if,elseif and  else.

// this is where it checks if Check Stock option is set to true and if stock is less then 1
if ((STOCK_CHECK == 'true')&&(tep_get_products_stock($listing['products_id']) < 1)) { 
$lc_text = TEXT_STOCK;
}
// if stock check is false and quantity is less than 1
elseif ((STOCK_CHECK == 'false')&&(tep_get_products_stock($listing['products_id']) < 1)) {
   $qty_array = array();
   for ($i=0; $ns = 20, $i <= $ns; $i++) {
       $qty_array[] = array('id' => $i, 'text' => $i); 
 } 
}
// if stock check is false and quantity is more than 1
else {
   $quantity = tep_get_products_stock($listing['products_id']); 
   $qty_array = array();
   for ($i=0; $ns = (($quantity < 20) ? $quantity : 20), $i <= $ns; $i++) {
       $qty_array[] = array('id' => $i, 'text' => $i); 
} 
}

If you dont care about the stock and has set it to false than you can safely comment out elseif code and replace the code in else block, above code will look like this.

if ((STOCK_CHECK == 'true')&&(tep_get_products_stock($listing['products_id']) < 1)) { 
$lc_text = TEXT_STOCK;
}
//         elseif ((STOCK_CHECK == 'false')&&(tep_get_products_stock($listing['products_id']) < 1)) {
//             $qty_array = array();
//             for ($i=0; $ns = 20, $i <= $ns; $i++) {
//              $qty_array[] = array('id' => $i, 'text' => $i); 
//              // tep_draw_input_field('Qty_ProdId_'.$product_info['products_id'],$cart->get_quantity($product_info['products_id']) ,'size="5"');
//              $lc_text = tep_draw_pull_down_menu('Qty_ProdId_' . $listing['products_id'], $qty_mos_next_idarray);                       
//              } 
//            }
else {
   //$quantity = tep_get_products_stock($listing['products_id']); 
   //$qty_array = array();
   //for ($i=0; $ns = (($quantity < 20) ? $quantity : 20), $i <= $ns; $i++) {
   //$qty_array[] = array('id' => $i, 'text' => $i); 

  // $lc_text = tep_draw_pull_down_menu('Qty_ProdId_' . $listing['products_id'], $qty_array);
           
// } 

/////////////////// this line generates the quantity text box 
 $lc_text = tep_draw_input_field('Qty_ProdId_'.$listing['products_id'],$cart->get_quantity($listing['products_id']) ,'size="10"');
}

This will always display text field for the slave quantity no matter what the stock is.

 

if you want drop down list based on actual quantity: Just replace the

for ($i=0; $ns = 20, $i <= $ns; $i++) {
AND
for ($i=0; $ns = (($quantity < 20) ? $quantity : 20), $i <= $ns; $i++)

with
     for ($i=0; $i <= $quantity; $i++){

 

     

To filter out slaves from new products :

Edit file: includes->modules-new_products.php

 

Add this filter to the where clause of the query, you can add this to any query where u want to filter out slave products:

p.products_status = '1' and p.products_listing_status = '1'

 

  if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
// start random new products
  $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS_TO_CATEGORIES . " INNER JOIN `products` `p` ON (`products_to_categories`.`products_id` = `p`.`products_id`) left outer join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_listing_status = '1' AND categories_id < '8' order by p.products_date_added desc");
 } else {
   $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as 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 where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by p.products_date_added desc limit " . MAX_RANDOM_SELECT_NEW);
// end random new products    
 }

 

 

I edited and updated both files. As for the quantity selection process, no matter which part of your advice I took, the drop down box was always present and always had 20 in it. When I set STOCK_CHECK to false for the second suggestion it placed the text box in the column heading instead of the rows for each slave product. It is getting close, and I have tried everything you suggested and still cannot seem to get it right.

 

As far as the filter, I did update that page and everything worked without errors except there was nothing in the new product box at all. Almost like it filtered all products when I only need master products to show up.

 

I appreciate the help you have offered so far, it has been progressive and I owe you many thanks. I am not strong in this field so I def need some assistance here. Thanks a lot!

Link to comment
Share on other sites

How to get Master Products and STS to work together?

 

Im trying to get Master Products an STS to work together.

Everything works fine, but not in the template file of product_info.

 

In the "STS and Master Products WITH product_info.php.html template" contr. you can read that you shall change a line in sts_product_info.php.

 

From:

$template['startform'] = tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . [B]'action=add_product'));[/B]

 

To:

$template['startform'] = tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . [B]'action=add_slave'));[/B]

 

The problem is when i press the add to cart button nothing will happend. I gues it is add_slave that is the problem.

 

Is there anyone who has get Master products and STS woring togehter?

Link to comment
Share on other sites

I edited and updated both files.  As for the quantity selection process, no matter which part of your advice I took, the drop down box was always present and always had 20 in it.  When I set STOCK_CHECK to false for the second suggestion it placed the text box in the column heading instead of the rows for each slave product.  It is getting close, and I have tried everything you suggested and still cannot seem to get it right.

 

As far as the filter, I did update that page and everything worked without errors except there was nothing in the new product box at all.  Almost like it filtered all products when I only need master products to show up.

 

I appreciate the help you have offered so far, it has been progressive and I owe you many thanks.  I am not strong in this field so I def need some assistance here.  Thanks a lot!

 

Try this for product master filter

if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
// start random new products
 $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS_TO_CATEGORIES . " INNER JOIN `products` `p` ON (`products_to_categories`.`products_id` = `p`.`products_id`) left outer join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_master_status = '1' AND categories_id < '8' order by p.products_date_added desc");
} else {
  $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as 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 where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_master_status = '1' order by p.products_date_added desc limit " . MAX_RANDOM_SELECT_NEW);
// end random new products    
}

 

For product quantity textbox post your code and i will look into it.

Link to comment
Share on other sites

CheckBoxes rather than quantity boxes

 

I have been looking at ways of trying to get a checkbox raher than a dropdown or quantity text box running as only 1 product will be ordered, None of the mods such as option type are quite right.

 

I am sure the changes are needed in themaster_listing.php file and have tried swapping

'MASTER_LIST_BUY_NOW':

 

$lc_align = 'center';

$lc_valign = 'top';

if ((STOCK_CHECK == 'true')&&(tep_get_products_stock($listing['products_id']) < 1)) {

$lc_text = '<input type="checkbox" name="products_id['.sizeof($list_box_contents).']" value="1">';

break;

} elseif ((STOCK_CHECK == 'false')&&(tep_get_products_stock($listing['products_id']) < 1)) {

$qty_array = array();

for ($i=0; $ns = 20, $i <= $ns; $i++) {

$qty_array[] = array('id' => $i, 'text' => $i);

 

$lc_text = tep_draw_input_field('Qty_ProdId_' . $listing['products_id'], '', 'size="4"');

 

}

} else {

$quantity = tep_get_products_stock($listing['products_id']);

$qty_array = array();

for ($i=0; $ns = (($quantity < 20) ? $quantity : 20), $i <= $ns; $i++) {

$qty_array[] = array('id' => $i, 'text' => $i);

 

$lc_text = tep_draw_input_field('Qty_ProdId_' . $listing['products_id'], '', 'size="4"');

 

}

 

Instead of the regular

 

case 'MASTER_LIST_BUY_NOW':

 

$lc_align = 'center';

$lc_valign = 'top';

if ((STOCK_CHECK == 'true')&&(tep_get_products_stock($listing['products_id']) < 1)) {

$lc_text = TEXT_STOCK;

} elseif ((STOCK_CHECK == 'false')&&(tep_get_products_stock($listing['products_id']) < 1)) {

$qty_array = array();

for ($i=0; $ns = 20, $i <= $ns; $i++) {

$qty_array[] = array('id' => $i, 'text' => $i);

 

$lc_text = tep_draw_input_field('Qty_ProdId_' . $listing['products_id'], '', 'size="4"');

 

}

} else {

$quantity = tep_get_products_stock($listing['products_id']);

$qty_array = array();

for ($i=0; $ns = (($quantity < 20) ? $quantity : 20), $i <= $ns; $i++) {

$qty_array[] = array('id' => $i, 'text' => $i);

 

$lc_text = tep_draw_input_field('Qty_ProdId_' . $listing['products_id'], '', 'size="4"');

 

}

 

I stll get text boxes not checkboxes.

 

Help would be most apreciated

 

Steve

Link to comment
Share on other sites

Hi all,

 

I notice something and cannot find the solution in this forum. I installed Master Products and is working fine. However, I notice that is customer will to click on the slave product which the browser will bring the to webpage of the slave products, is there anyway to create a link for the customer to click to go to it's master product without affecting it's SessionID as if I just create a direct link to the master product, all the customer product records will be gone as the SessionID is gone.

 

I am a novice for php and am trying to figure out how can this be done. Pls help.

 

Thanks in advance.

Link to comment
Share on other sites

Is there anyone that can help with my query? I still unable to figure out how to link my slave products back to master product webpage. Appreciate if there will be any expert to advise how to go about it.

Link to comment
Share on other sites

Hi all,

 

I notice something and cannot find the solution in this forum. I installed Master Products and is working fine. However, I notice that is customer will to click on the slave product which the browser will bring the to webpage of the slave products, is there anyway to create a link for the customer to click to go to it's master product without affecting it's SessionID as if I just create a direct link to the master product, all the customer product records will be gone as the SessionID is gone.

 

I am a novice for php and am trying to figure out how can this be done. Pls help.

 

Thanks in advance.

 

Add the following function to /includes/functions/general.php:

 

//Get products master ? 
?function tep_get_products_master($product_id) {

? ?$product_query = tep_db_query("select products_master from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'");
? ?$product = tep_db_fetch_array($product_query);

? ?return $product['products_master'];
?}

 

Then add the following to product_info.php just below the call to application_top.php:

 

 $product = $HTTP_GET_VARS['products_id'];
$master = tep_get_products_master($product);
if ($master > 0) {
?tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $master));
}

 

That is one way - the function can be used in other ways, so is useful. You could instead remove any links in the slave listing in /includes/modules/master_listing.php :P

 

Matti

Edited by Johnson
Link to comment
Share on other sites

Dear Matti,

 

I have never been so happy as I am stuck with this problem trying to look for solution since 2-3 weeks ago. Due to lack in knowledge of PHP programming, I am so glad that help has finally arrived. You are really great. Thanks again pal.

 

:thumbsup:

Link to comment
Share on other sites

  • 3 weeks later...

I am not sure if this is a Master Products issue or a PayPal issue, so have taken the liberty of posting in both threads!!

 

I am testing the OCCommerce PayPal IPN with the PayPal sandbox.

 

I have Downloads Controller 5.3 working like a dream

 

I have an ammended Master Products which allows slaves (tracks) or complete album downloads

 

With all products at zero cost it works perfectly, I can "buy" individual tracks or albums and all the right tracks or albums appear for download after the "purchase" is confirmed

However, when I introduce pricing, PayPal works fine with slave products but when I purchase a Master (in this case an album's worth of tracks), although the purchase goes through OK, I don't have any tracks to download as I do when I purchase the tracks individually.

 

 

Steve

Link to comment
Share on other sites

That sounds like an issue to do with the order status - Download Controller works on the basis that the order status should be set to 'updated' until the Paypal module confirms payment. My Paypal IPN settings are (under Modules, Payments)

 

Set Preparing Order Status

Updated

 

Set PayPal Acknowledged Order Status

Delivered

 

Make sure that you have created the default value of 'updated' under Localisation/Order Status

 

Works fine for me at http://www.fallshop.co.uk/shop on Paypal IPN (links appear on checkout success page), Nochex APC (links appear on checkout success page) and cheque/PO (links do not appear until I get the money and physically change the status to delivered...

 

Hope that helps :)

Edited by clayts
Link to comment
Share on other sites

And now for my own question - I use osPlayer - works fine on products not defined as a Master (eg here).

 

However when I set a master to a zero price, there is no option in Categories/Products to add the MP3 player to the master product page - for the slaves, however, there is. Despite this, even with the slaves marked as having osPlayer activated, they still don't appear - eg. here - any workround available for this ?

 

And I know it's been asked before, but I'm afraid I'm too dumb to work out the instructions provided before : can someone please give me an idiot's guide to removing reference to the individual slaves in what's new, etc ?

 

Thanks :)

Link to comment
Share on other sites

Thanks for the suggestion, even with all the settings as you said, I still have the same problem.

 

Individual tracks (Slaves) behave as they should, it's the Albums that won't perform under PayPal

 

It's as if there is a break in the instructions that tell the checkout-success page what to display, i.e. a list of the tracks that you have purchased for download. Somewhere along the line the Master lost its contents so as to speak.

 

Steve

Link to comment
Share on other sites

The way I work it is that the album has no value, it is simply a container for the slave products - as you can see from this page, the slave products can (if folks want) be bought separately. However, if they just select 'Add to Cart' the whole lot shift over (I have set the quantities of each track to 1 by default).

 

How have you got your Master set up - that may be the key (eg I still have it set with product attributes as a download, same format as the slaves, but as it has a NIL value, it won't appear with an option to buy just the master ) ?

Link to comment
Share on other sites

Mine is set up differently to yours, With one checkbox for the album and individual checkboxes for the tracks.

 

I know that the Master info passes through the system when I am not using PayPal, as I get all the tracks ready for download on the success page.

 

I know that the Paypal module is working as I can purchase individual slaves

 

I tried your suggestion re attributes with no joy I'm afraid.

 

Still no sign of the album tracks when purchasing with PayPal

 

Thanks again

 

Steve

Link to comment
Share on other sites

I know I had to do a fair few tweaks on Download Controller yesterday to get it to work....this post in particular was very helpful :)

 

Give that a whirl....it did the business for me, eventually.

 

I still think the problem lies with the attributes of the Master. Do you have a different total price for the Master in comparison with the sum total of all the individual tracks ?

 

I think (and no offence to Matty) this is where Master Products would do well to include the features offered by Bundled Products - now with that one, I really did find some problems - I couldn't get the download links no matter what. Hence the workround I employ now - no price for Master, but total of slaves-total price I'd want to charge - it's very rare that folks buy separate tracks (maybe as a trial, although that's why I wants osPlayer working on the Master Product pages, so they don't have to ;))

Link to comment
Share on other sites

The album price is an exact multiple of the track price. As the DC works fine with Albums when there is no interaction with PayPal, it is I think more likely that the problem lies with the PaPal module losing the Master info. It makes no difference if the album has any attributes or not.

 

I agree with you re bundled products...I spent a week of hell trying to get that to work!

 

I am going to look through that post to see if there is anything in there for me

 

Steve

Link to comment
Share on other sites

Steve - could I ask who hosts your site please (and a URL to your site would be good too) - I've just been booted off mine for excess bandwidth/CPU usage :lol:

Link to comment
Share on other sites

i've installed master products and master accessories in the exact order as described in the latest installation update.

 

i can add 2 slave products that are both assigned to a master to the shopping cart okay.

 

when i go to add one of those slave products individually, or if a add a normal product (non-slave and non-master), it proceeds to the shopping cart, only to say it is EMPTY!.

 

any ideas? i feel the problem lies in product_info.php.

 

note: i am using product_listing_col code to show the listing of products in columns, however this should not interfere with this current problem, as current problem seems to be from product_info > shopping_cart.php

Link to comment
Share on other sites

Hi all :)

 

I am trying to get WISH LIST 2.4 to work with Master Products but I can't seem to get it for some reason.

 

Everything shows up like it is suposed to but when you click on "Add to wishlist" it takes you to your shopping cart and your wishlist box (and page) says there is nothing there.

 

I *think* it has something to do with the code change in the application_top.php but I am not sure. Has anyone been able to get these two contributions to work together?

 

Any suggestions would be greatly appreciated.

Thanks!

Wendy James

 

Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.

Link to comment
Share on other sites

Couple of issues please.

 

Firstly when clicking on a the little scrolly thing to the left of the product name in admin/categories I get this :

 

1064 - You have an error in your SQL syntax near ' p.products_master from products p, products_description pd where p.products_id' at line 1

select p.products_id, pd.language_id, pd.products_name, pd.products_description, pd.products_head_title_tag, pd.products_head_desc_tag, pd.products_head_keywords_tag, pd.products_url, p.products_quantity, p.products_model, p.products_image, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.manufacturers_id from, p.products_master from products p, products_description pd where p.products_id = pd.products_id and p.products_id = '79'

[TEP STOP]

 

Any ideas how to fix this ?

 

Secondly, there was a lot of talk last year between Matti, Richard and Ryan about being able to remove the quantity box (see posts 751 , 752, 764 and 768.

 

Matti's fix in 752 works fine. What I am having bother with is adding in Ryan's code in post 764 - exactly where am I supposed to put this in the products_info.php file - I really couldn't work it out, I'm afraid (bit of a php virgin, I'm afraid).

 

Essentially what I want is for the master product price to show up throughout the site, but for it not to possible to add it to the cart, or for a quantity box to appear. Whilst the crude fix of sticking the price in the product description works to a limited extent (eg the text in red here) it looks as if I'm giving away stuff in this page (eg second entry down) when clearly I'm not.

 

Any help would be great - if I can get that bit sorted, I should then be able to get osPlayer working on Master Products pages - at present I cannot as they have no value :(

 

Thanks people :)

Edited by clayts
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...