Jump to content
zonetown

[Contribution] QTpro - Quantity Tracking Professional

Recommended Posts

I fixed the code for the layout, so I got rid of the old drop downs. Now If I can just Sort the attributes, and get them all to show up properly.


++++++++++++++++++++

Im just a guy, Nothing more

++++++++++++++++++++

Share this post


Link to post
Share on other sites

Hi Everyone.

 

This should be a fairly easy mod for those of you who are inclined to this sort of thing. I used to think I was ... but I can't for the life of me figure out how to make this "SIMPLE" mod for QTPro work.

 

This is something I thought I would just want to do for my own purposes but the more I think about it, it might be something that the contributors to this contribution might want to add for future updates to QTPro.

 

 

Here's the LOW down. :sweating:

 

 

I have installed QTPro on my osCommerce shop. Everything is working perfectly! I wanted to be able to change one thing .... just one thing ... one ... simple ... thing ... I thought anyways...

 

I'm using the Multiple Drop Down menu and enabled the "Display Out of Stock Message Line". As you probably know, the message line displays a generic message ... something like, "The combination of options you have selected is currently out of stock. Please select another combination." This message appears when the user selects an out of stock option combination.

 

My idea, was to change this line to read something like, "combination of options you have selected is currently out of stock. Please click here for information on how to order ..." Blah Blah Blah. I won't get into specifics but I basically needed to add a link to this message.

 

So I set off on my journey to insert the link. First, I traced back the "out of stock" message to the define TEXT_OUT_OF_STOCK_MESSAGE located in includes/laguages/english/product_info.php. I changed this message and added some HTML to it thinking this would do the trick. No go!

 

I then trace the TEXT_OUT_OF_STOCK_MESSAGE usage to includes/classes/pad_multiple_dropdowns.php. I noticed that this was used in two areas in this document ... one for the message error box (the red error message that appears on the page) and one for the popup alert box if the user tried to continue placing the order regardless of the first message. I figured I would define a new "out of stock" message just for the alert box so that I could redefine the original TEXT_OUT_OF_STOCK_MESSAGE for my purposes.

 

I tried slaying the @#$%er (excuse my #$%@) a few times but kept coming up short. I then noticed that the message could only display text because the output line on 156 of pad_multiple_dropdowns.php was using the DOM "document.createTextNode" and javascript to append to the message ... like this:

 

$out.=" span.appendChild(document.createTextNode(\"".TEXT_OUT_OF_STOCK_MESSAGE."\"));\n";

 

I won't get into detail explaining what the above line means ... because I already know and I'm sure the person that can figure this out for me would already know as well but basically "span" was previously defined as the message box section and we are appending to this with our TEXT_OUT_OF_STOCK_MESSAGE using the text node (element). ... I though I wasn't going to get into detail!?!

 

Anyways, I've tried several approaches of inserting a link into this node ... which I guess is impossible and so I tried several ways of insert some text and a link into the messagebox itself.

 

 

So alas, I'm left with this challenge. Can anyone help me to figure out how I can modify the "out of stock" message to include a link?!?

 

Please don't let this post be waisted wit and humor. (I'm a mind reader too you know ... "What wit and humor?", you say.)

 

 

Seriously ... any help would be GREATLY, GREATLY appreciated!

 

Looking forward to the responses

Olimess

Share this post


Link to post
Share on other sites

Hi! Just wanted to say I have not managed to fix the issue above with getting Wish List 3.5d to work with QTPro 4.2. Attributes are not included in wish list. The deadline did not work as usual but the store must open during next week. If someone (I believe someone must have used Wish List and QT Pro together) know how to do this in application_top.php please please let me know!!

Share this post


Link to post
Share on other sites

Hi all, i have installed QTpro 4.2, all working well i have only a problem when make order and checkout in admin order i see the order but i dont see the product i buy :-) i see only the price, tax, tot. etc. but i dont see the quantity of product and what products i buy.

For the rest the contribution working well.

Someone have a answer or me.

Thanks

Share this post


Link to post
Share on other sites
snip....

 

I tried slaying the @#$%er (excuse my #$%@) a few times but kept coming up short. I then noticed that the message could only display text because the output line on 156 of pad_multiple_dropdowns.php was using the DOM "document.createTextNode" and javascript to append to the message ... like this:

 

$out.=" span.appendChild(document.createTextNode(\"".TEXT_OUT_OF_STOCK_MESSAGE."\"));\n";

 

I won't get into detail explaining what the above line means ... because I already know and I'm sure the person that can figure this out for me would already know as well but basically "span" was previously defined as the message box section and we are appending to this with our TEXT_OUT_OF_STOCK_MESSAGE using the text node (element). ... I though I wasn't going to get into detail!?!

 

Anyways, I've tried several approaches of inserting a link into this node ... which I guess is impossible and so I tried several ways of insert some text and a link into the messagebox itself.

So alas, I'm left with this challenge. Can anyone help me to figure out how I can modify the "out of stock" message to include a link?!?

Try appending the message in 3 pieces: a text node, an anchor node and another text node. Something like:

   $out.="	  span.appendChild(document.createTextNode(\"Please \"));\n";
  $out.="	  anchor=document.createElement(\"A\"));\n";
  $out.="	  anchor.href=\"http://overtherainbow.com\";\n";
  $out.="	  anchor.appendChild(document.createTextNode(\"click here\"));\n";
  $out.="	  span.appendChild(anchor);\n";
  $out.="	  span.appendChild(document.createTextNode(\" for more info\"));\n";

If you want the link to open in a new window you can set the target property of the anchor.

 

Please don't let this post be waisted wit and humor.

My waist is already too big!

Share this post


Link to post
Share on other sites
Try appending the message in 3 pieces: a text node, an anchor node and another text node. Something like:

   $out.="	  span.appendChild(document.createTextNode(\"Please \"));\n";
  $out.="	  anchor=document.createElement(\"A\"));\n";
  $out.="	  anchor.href=\"http://overtherainbow.com\";\n";
  $out.="	  anchor.appendChild(document.createTextNode(\"click here\"));\n";
  $out.="	  span.appendChild(anchor);\n";
  $out.="	  span.appendChild(document.createTextNode(\" for more info\"));\n";

If you want the link to open in a new window you can set the target property of the anchor.

My waist is already too big!

 

 

 

Thanks for the help .... unfortunately I'm still having problems using your approach. Seems wierd but if I to use more than one line inside the IF statement ... it won't work. I'm still trying to work through this to see if I can come up with another solution to this problem.

 

 

If anyone else has any thoughts ... please read my original post about three post up or so.

 

 

THanks everyone.

Share this post


Link to post
Share on other sites

Does anyone know some code to add the total stock available before the quantity inputbox in the shopping_cart.php, QT PRO related of course.

Thanks.

Edited by Fons

Share this post


Link to post
Share on other sites
Thanks for the help .... unfortunately I'm still having problems using your approach. Seems wierd but if I to use more than one line inside the IF statement ... it won't work. I'm still trying to work through this to see if I can come up with another solution to this problem.

If anyone else has any thoughts ... please read my original post about three post up or so.

THanks everyone.

Did you wrap the multiple lines in braces? Like this:

 

$out.="	if (!instk) {\n";
$out.="	  span.appendChild(document.createTextNode(\"".TEXT_OUT_OF_STOCK_MESSAGE."\"));\n";
$out.="	  span.appendChild(document.createTextNode(\"Please \"));\n";
$out.="	  anchor=document.createElement(\"A\"));\n";
$out.="	  anchor.href=\"http://overtherainbow.com\";\n";
$out.="	  anchor.appendChild(document.createTextNode(\"click here\"));\n";
$out.="	  span.appendChild(anchor);\n";
$out.="	  span.appendChild(document.createTextNode(\" for more info\"));\n";
$out.="	} else\n";

 

 

 

- Ralph

Share this post


Link to post
Share on other sites

Hi,

 

I've read through the whole of this forum, and don't think I've found the answer to my question. Although much of my reading has been late at night, so I may have been a bit off form!

 

I am trying to get QTPro 4.2 working along with PayPal_IPN v1.1. Following suggestion here I have merged all of the QTPro chnages to checkout_process.php into paypal_ipn.php. Unfortunately this doesn't seem to have worked.

 

Has anyone come across a solution for making this work, or am I better to uninstall the PayPal IPN v1.1 module and install the alternative PayPal IPN 3.1.5 module which some people seem to have working? The 1.1 version appealed initially because of its simplicity to install.

 

Thanks

 

Barry

Share this post


Link to post
Share on other sites

Hi,

 

i already posted this question in the general section, but i guess this is the right place:

 

i found a bug in the stock tracking feature of qt pro. before a customer adds a product into his shopping cart, there is a check, if the product is still available, but there is no check, when the customer checks out and finishes his order.

this can lead to the following problem:

if there is only 1 piece of a product available, 2 people can add it to their cart at the same time and finish the order. the stock count of the product is decreased from 1 to -1 and both customers ordered the product (if this product was a unicum the shop owner has a problem now, since both customers already got their confirmations).

 

i set the "allow checkout" field to false, but the shop doesnt realize, that the product is sold out in this case.

 

anybody else experienced that problem or knows how to fix it?

 

regards,

AndiZed

Share this post


Link to post
Share on other sites

Hello iv been trying to figure out how to sort the Dropdowns to my likeing, and trying to fix the problem of only some of the items showing up in the dropdowns, but with no luck.

 

If any one can help me with this I would greatly apperciate it. The problems are:

 

A) The drop downs are in the wrong order,

B) Even though, they are put as in stock, only some of the items are in the drop down.

 

If some one can point me to an answer, or show me a solution it would help alot.! Thank you.


++++++++++++++++++++

Im just a guy, Nothing more

++++++++++++++++++++

Share this post


Link to post
Share on other sites
Hi,

 

i already posted this question in the general section, but i guess this is the right place:

 

i found a bug in the stock tracking feature of qt pro. before a customer adds a product into his shopping cart, there is a check, if the product is still available, but there is no check, when the customer checks out and finishes his order.

this can lead to the following problem:

if there is only 1 piece of a product available, 2 people can add it to their cart at the same time and finish the order. the stock count of the product is decreased from 1 to -1 and both customers ordered the product (if this product was a unicum the shop owner has a problem now, since both customers already got their confirmations).

 

i set the "allow checkout" field to false, but the shop doesnt realize, that the product is sold out in this case.

 

anybody else experienced that problem or knows how to fix it?

 

regards,

AndiZed

 

i found out what the problem is:

the last stock check is performed when loading the checkout_confirmation.php page, but the stock is decreased, when hitting the submit button on this page.

the following problem might appear:

2 users put the last item of a unique product into their carts, both of them enter the checkout confirmation page at the same time, i.e. both passed the last stock check and can finish their orders.

i tried to solve that problem by performing another stock check in checkout_process.php shortly before the stock is decreased and the order is going to be finished.

Share this post


Link to post
Share on other sites
i found out what the problem is:

the last stock check is performed when loading the checkout_confirmation.php page, but the stock is decreased, when hitting the submit button on this page.

the following problem might appear:

2 users put the last item of a unique product into their carts, both of them enter the checkout confirmation page at the same time, i.e. both passed the last stock check and can finish their orders.

i tried to solve that problem by performing another stock check in checkout_process.php shortly before the stock is decreased and the order is going to be finished.

Note that this is NOT a problem introduced by QT Pro. This is a base osCommerce problem. QT Pro only adds attribute inventory tracking, it doesn't attempt to change the inventory stock check points in the base code. osCommerce really needs to use database transactions at a minimum around key updates to avoid things like this and to avoid internal database inconsistencies when errors occur.

Share this post


Link to post
Share on other sites
Hello iv been trying to figure out how to sort the Dropdowns to my likeing, and trying to fix the problem of only some of the items showing up in the dropdowns, but with no luck.

 

If any one can help me with this I would greatly apperciate it. The problems are:

 

A) The drop downs are in the wrong order,

B) Even though, they are put as in stock, only some of the items are in the drop down.

 

If some one can point me to an answer, or show me a solution it would help alot.! Thank you.

 

Any help? :-"


++++++++++++++++++++

Im just a guy, Nothing more

++++++++++++++++++++

Share this post


Link to post
Share on other sites

Hi there, I've been installing and testing the QTPro contribution on a test site; it looks and works great for all my products which have attributes, AND have their stock tracked... If a product does not have an attribute which has 'track stock enabled', or it doesn't have any attributes, it is marked 'OUT OF STOCK' as soon as it is put into the the shopping cart?

 

The install notes seem to suggest that this should work OK, but I can't get it to.

 

I'm using;

 

multiple dropdowns

 

show out of stock attributes : False

mark out of stock attributes : Right

display out of stock message line : True

prevent adding out of stock to cart : True

 

my other stock options are:

 

check stock level : True

subtract stock : True

allow checkout : False

mark product out of stock : out of stock

stock re-order level : 5

 

I've had a good look through product_info.php and shopping_cart.php, but to no avail...

 

Any ideas??

Share this post


Link to post
Share on other sites

can someone me say what can i do to insert a textfield ?

 

i will have a option for my customers, than he can say i will this t-shirt with this text.

 

the contrieb optionstype-feature 1.7.1 have this.

Share this post


Link to post
Share on other sites

here's a problem that that has been covered before but all i can see are references to paypal IPN... i need some advice on paypal stock/standard version

 

i am not using paypal IPN so havent had the problems that people have had... my own site has no problems about stock not being updated etc

 

my problem is that item name is being sent to paypal and subsequently to me (as payment received) but no mention of the attribute.

 

Example, if 2 oranges 'small' and 2 apples 'green' are purchased... paypal page shows:

 

oranges, apple,

 

when it should show 2xoranges small, 2xapple green

 

it doen't show the attributes and the quantity - i need help

 

the problem is that even if the stock and attributes get updated correctly (thank heaven) the email should at least have the correct information to save confusion...

 

does anyone know how to do this please?

 

here's my paypal (NOT paypal IPN) info:

 

$process_button_string = tep_draw_hidden_field('cmd', '_xclick') .

tep_draw_hidden_field('business', MODULE_PAYMENT_PAYPAL_ID);

for ($i=0; $i<sizeof($order->products); $i++) {

$item_name .= ' '.$order->products[$i]['name'].' ,';

}

$item_name = substr_replace($item_name,'',-1);

$process_button_string .= tep_draw_hidden_field('item_name', $item_name);

$process_button_string .= tep_draw_hidden_field('amount', number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) .

tep_draw_hidden_field('shipping', number_format($order->info['shipping_cost'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) .

 

tep_draw_hidden_field('currency_code', $my_currency) .

tep_draw_hidden_field('return', tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL')) .

tep_draw_hidden_field('cancel_return', tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));

 

 

i have tried lots of coding to get it to show the attributes... can anyone please advise. it clearly shows the item AND attributes on the checkout_payment.php page but it isn't going on with the attributes and quantity to paypal

 

i have searched the forum but can't find anything. in the event that this has been covered, please accept my apology and kindly point me to the right post

 

many thanks

Edited by chooch

Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Share this post


Link to post
Share on other sites

When preventing from adding to cart I would like the popup to show on products with no attributes. How is that done? At this moment the popup only shows on products with attributes.

 

(It's important that the customer is informed soonest possible. If the buy products with no attributes and do not see the message in cart they won't be prevented until after creating account and so on..)

 

Thanks!

Edited by Fredrik.r

Share this post


Link to post
Share on other sites

Hi, Ralph,

 

Thanks for a fantastic contribution!

 

I need to have the following capabilities in my store, mainly for wholesale customers, where I need them to be able to order multiple versions of a product (size and colour) in one go:

 

1. List the product attrubutes on the product_info.php page in a table instead of the pull-down menu.

2. Adds a quantity input box for each attribute.

3. Shows the actual price with the attribute instead of the '+/- XXX'

 

I actually took this from a nice contribution found here, but with QT Pro I think I need a pad, and since I am not really a programer, some help/direction will be greatly appreciated.

 

Thanks,

 

Zvi

Share this post


Link to post
Share on other sites

Hi Ralph and other QT Pro experts!

 

Happy New Year to one and all and thanks to Ralph for a great contrib!

 

I've been using QTPro for quite a while now, it solved a problem I originally had but I've been thinking about the way it works. My issue is that we have 2500 designs that can be printed onto any of 10 garments, some of which come in 12 colours and a range of 8 sizes - 58 attribute combinations!

 

The way the Store is built, each of the designs is a product, with the size, colour and garment type as attributes. Basically there are 826 combinations for each of 2500 designs - this creates a products_stock table of about 1.7 million records! I populate this with about 50 csv files with 30,000 rows each. Although I have a macro that writes the csv's, the actual population and control of products_stock is quite an epic, as you may well understand.

 

Now, my thoughts on this are : Since the stock control and indeed attributes for each of the 2500 products is identical, is there a way of populating products_attributes and the related tables with 1 set of attributes - say for product_id = 0, and then do the same for products_stock, again for product_id = 0.

 

Then, could the code be changed to call the attributes for product_id = 0 and therefore the related stock listing for product_id = 0 from products_stock?

 

This would reduce my attributes table and products_stock table drastically!!

 

Any thoughts on whether this would work and how to do it - where in the QT Pro mod I would need to change "products_id = products_id" to "products_id = 0" (hardcoded) etc would be most appreciated!

 

Regards,

 

Simon

Share this post


Link to post
Share on other sites

In your product_info.php is the code which calls the attributes. It is a dynamic query that gets the current product_id number. In the part in products_info.php, change the part where it is getting the product_id number (it will most likely look something like tep_db_query("stuff goes here... WHERE products_id=."$product_id.");

 

Change the WHERE products_id=."$product_id." to WHERE products_id= '0'. Then go into your databases and change the universal set of attributes' products_id number (I dont know what the column is called) to 0. This should work.

Share this post


Link to post
Share on other sites

After the installation of qtpro, the sort order of attributs doesn't function any more.

Somebody has it already to encounter the same problem and has it to find a solution.

I think that the code has to change is in product_info.php towards the lines

 

//++++ QT Pro: End Changed Code
$products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'order by popt.products_options_sort_order");
$products_attributes = tep_db_fetch_array($products_attributes_query);
if ($products_attributes['total'] > 0) {
//++++ QT Pro: Begin Changed code
  $products_id=(preg_match("/^\d{1,10}(\{\d{1,10}\}\d{1,10})*$/",$HTTP_GET_VARS['products_id']) ? $HTTP_GET_VARS['products_id'] : (int)$HTTP_GET_VARS['products_id']);
  require(DIR_WS_CLASSES . 'pad_' . PRODINFO_ATTRIBUTE_PLUGIN . '.php');
  $class = 'pad_' . PRODINFO_ATTRIBUTE_PLUGIN;
  $pad = new $class($products_id);
  echo $pad->draw();
//++++ QT Pro: End Changed Code
?>


<!--		  <table border="0" cellspacing="0" cellpadding="2">
		<tr>
		  <td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>
		</tr>
<?php
  $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_sort_order");
  while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
	$products_options_array = array();
	$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "' order by pa.products_options_sort_order");
	while ($products_options = tep_db_fetch_array($products_options_query)) {
	  $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
	  if ($products_options['options_values_price'] != '0') {
		$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
	  }
	}

	if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
	  $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
	} else {
	  $selected_attribute = false;
	}
?>
		<tr>
		  <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
		  <td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>
		</tr>
<?php
  }
?>
	  </table>
-->

 

Sorry for my english, and thank you for your assistance

Edited by krys_lyon

Share this post


Link to post
Share on other sites

Just wanted to check again if someone knows how to show a popup for products with no attributes when having prevent adding to cart active. See my post above (#943)

Share this post


Link to post
Share on other sites

Can any one help me with this issue?

 

Im trying to get QTPro to work with EasyPopulate. But I just cant figure it out.

If any one has this working if they would give me a run down on how to use the Tab Delimited files to work with QTPro.

 

Please!

 

I have a tonn of stock to input.


++++++++++++++++++++

Im just a guy, Nothing more

++++++++++++++++++++

Share this post


Link to post
Share on other sites

Hi again. I still do not know how to do this;

 

1, I want the "Out of stock" message to show in products_info.php for products with NO attributes too. As it is right now that message is only shown in the drop downs for products with several attributes.

 

2, Is it also possible to prevent adding to cart / show the popup for products without attributes?

 

Thanks! Help is very much appreciated!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×