Author Topic: MOD: Child list instead of drop down. UPDATE(1.0.11) + store wide quantity mod  (Read 377857 times)

macallf

  • Hero Member
  • *****
  • Posts: 2411
    • Mark Callf Design
**UPDATE Please see this post for updated files

Now updated to work with VM 1.0.5
ChildList 1.0.5

Now updated to work with VM 1.0.6
ChildList 1.0.6

Major update with system wide quantity box mod
ChildList 1.0.6 Update

Updated to work with VM 1.0.7
ChildList 1.0.7

Updated to work with VM 1.0.9
ChildList 1.0.9

Updated to work with VM 1.0.10
ChilList 1.0.10

Updated 1.0.10- fixes a problem with advanced attribute pricing
Chillist 1.0.10-1

Please note- All further updates will be posted on my site

Updated for VM 1.0.11
Mark Callf Designs



I have searched the forum on how to make child products display as a list instead of a dropdown list.
The image at the bottom of this diplays the outcome.

I couldn't find any info so I modified the code to allow this.


[attachment cleanup by admin]
Mark
All of My old mods are now available on my website.
Mark Callf Designs

If you like the work I've done for VM please fell free to Donate

Please Note: I am no longer actively developing or involved with VM development.

Amina

  • Beginner
  • *
  • Posts: 10
Re: MOD: Child list instead of drop down.
« Reply #1 on: March 13, 2006, 00:04:44 am »
ARRRRRGGGGGHHHHH ???

Hi,

I have attempted to configure the coding that you have mentioned word for word and have corrupted the entire virtuemart component.  I can not afford to remove the component based on the work crried out. therefore please take a look at www.dermaology.com and go to the shopping section and if need be i can give you access to the actual ftp section if you want to guide me manually, please do not let me down

macallf

  • Hero Member
  • *****
  • Posts: 2411
    • Mark Callf Design
Re: MOD: Child list instead of drop down.
« Reply #2 on: March 13, 2006, 00:51:21 am »
Hi,

Can't see the problem because nothings being displayed.

Have you tried changing line 299 in administrator\components\com_virtuemart\html\shop.product_details.php

from .$ps_product_attribute->list_attribute_list($product_id) back to .$ps_product_attribute->list_attribute($product_id)

and change line 305 from if (USE_AS_CATALOGUE != '1' && $product_price != "" && ($db_product->f("product_parent_id")) == '0' && !stristr( $product_price, $VM_LANG->_PHPSHOP_PRODUCT_CALL )) {

back to

if (USE_AS_CATALOGUE != '1' && $product_price != "" && !stristr( $product_price, $VM_LANG->_PHPSHOP_PRODUCT_CALL )) {

This should restore the original functionality of the drop down list.

You could attach the shop.product_details.php & ps_product_attribute.php and I could check the modification and test it on my site.

Hope this helps

Mark
Mark
All of My old mods are now available on my website.
Mark Callf Designs

If you like the work I've done for VM please fell free to Donate

Please Note: I am no longer actively developing or involved with VM development.

Amina

  • Beginner
  • *
  • Posts: 10
Re: MOD: Child list instead of drop down.
« Reply #3 on: March 13, 2006, 13:11:03 pm »
http://www.dermaology.com/administrator/components/com_virtuemart/classes/ps_product_attribute.php

The problme orginated from here, but I havereverted back to the original format, but still getting this error message:

Parse error: syntax error, unexpected '/' in /home/.dennis/ischola1/dermaology.com/administrator/components/com_virtuemart/classes/ps_product_attribute.php on line 259

http://www.dermaology.com/administrator/components/com_virtuemart/html/shop.product_details.php

I have made the modification from http://virtuemart.net/index.php?option=com_smf&Itemid=71&topic=9824.0
prior to using your modification.

But can all this have been resolved if I had downloaded the module you have attached with this thread?

Thanks for the trouble and let me know

Amina

  • Beginner
  • *
  • Posts: 10
Re: MOD: Child list instead of drop down.
« Reply #4 on: March 13, 2006, 13:42:15 pm »
Sorry I did not attach the relevant file, I do not think you can access using the ftp file I have given a link for;

I am usure how to attach a file! sorry. maybe you want to drop me a line at amina@dermaology.com and I can attach the file via my email. 

thanks

macallf

  • Hero Member
  • *****
  • Posts: 2411
    • Mark Callf Design
Re: MOD: Child list instead of drop down.
« Reply #5 on: March 13, 2006, 13:42:38 pm »
Hi Amina,

Can you actually attach the offending file to your next next post. I can then check it our against my originals and test it.
If you can zip up this file ps_product_attribute.php and attache it or change the extension from php to txt and attach it.

I did not actually attach any file to the original message just a diff file that allows patching of files.

I Have just reedited a standard file and tested it and it works fine on my test site.

I Have attached this just unzip and overwrite the original.(PLEASE BACK IT UP FIRST).

Hope this helps

Mark





[attachment cleanup by admin]
Mark
All of My old mods are now available on my website.
Mark Callf Designs

If you like the work I've done for VM please fell free to Donate

Please Note: I am no longer actively developing or involved with VM development.

Amina

  • Beginner
  • *
  • Posts: 10
Re: MOD: Child list instead of drop down.
« Reply #6 on: March 14, 2006, 00:39:00 am »
Hi Mark,

I think it is sorted :o

I reloaded virtuemart, did not apply the 'stay on the same pag instead of going to cart' hack and just implemented your hack and it all looks good......

Your a good man


macallf

  • Hero Member
  • *****
  • Posts: 2411
    • Mark Callf Design
Re: MOD: Child list instead of drop down.
« Reply #7 on: March 14, 2006, 02:40:47 am »
Hi Amina,

The problem lies with the show no cart mod, which assumes you are using php5.

The code for php5 is
Code: [Select]
if(stripos($_SERVER['HTTP_REFERER'],'category_id') ||
   stripos($_SERVER['HTTP_REFERER'],'product_id') ||
      stripos($_SERVER['HTTP_REFERER'],'shop.browse') )
      //if has category_id, then add to session or overwrite old referer variable
      {
           $_SESSION['referer'] = $_SERVER['HTTP_REFERER'];
      }

To make this more universal replace the above code with.

Code: [Select]
if(strpos(strtolower($_SERVER['HTTP_REFERER']),strtolower('category_id')) ||
   strpos(strtolower($_SERVER['HTTP_REFERER']),strtolower('product_id')) ||
      strpos(strtolower($_SERVER['HTTP_REFERER']),strtolower('shop.browse')) )
      //if has category_id, then add to session or overwrite old referer variable
      {
           $_SESSION['referer'] = $_SERVER['HTTP_REFERER'];
      }

This code works with earlier versions of PHP.

Mark
Mark
All of My old mods are now available on my website.
Mark Callf Designs

If you like the work I've done for VM please fell free to Donate

Please Note: I am no longer actively developing or involved with VM development.

macallf

  • Hero Member
  • *****
  • Posts: 2411
    • Mark Callf Design
Re: MOD: Child list instead of drop down.
« Reply #8 on: March 15, 2006, 20:55:10 pm »
I have been working on a modification to my mod.

I noticed everytime you clicked on an 'add to cart' link that the page went to that childs details page.

This mod/hack keeps the product on the parents detail page. Benefits of this are

  • You do not have to duplicate product descriptions. The parents are always used
  • No need to apply an image to each child, again the parent image is used
  • Only have to have similar products created on the parent item

So if you are using multiple child items and the descriptions do not change, your shop will be easier to setup and maintain.

classes/ps_cart.php has to be modified.

Every occurence of $d['product_id] has to be changed to $d['prod_id'] There are several of these in the file so just search for every occurence and replace.

In classes/ps_product.attributes.php

change
Code: [Select]
$html .= "<input type=\"hidden\" name=\"product_id\" value=\"".$db->f("product_id") ."\"><td>";

about line 246 to
Code: [Select]
$html .= "<input type=\"hidden\" name=\"prod_id\" value=\"".$db->f("product_id") ."\"><td>";
$html .= "<input type=\"hidden\" name=\"product_id\" value=\"".$parent_id."\"><td>";

and change
Code: [Select]
$html = "<input type=\"hidden\" name=\"product_id\" value=\"$product_id\" />\n";
about line 300 to
Code: [Select]
$html = "<input type=\"hidden\" name=\"prod_id\" value=\"$product_id\" />\n";
            $html .= "<input type=\"hidden\" name=\"product_id\" value=\"$product_id\" />\n";

in classes/shop.browse.php change
Code: [Select]
<input type=\"hidden\" name=\"product_id\" value=\"". $db_browse->f("product_id") ."\" />\n
About line 400 to
Code: [Select]
<input type=\"hidden\" name=\"product_id\" value=\"". $db_browse->f("product_id") ."\" />\n
                <input type=\"hidden\" name=\"prod_id\" value=\"". $db_browse->f("product_id") ."\" />\n

This just passes the parent_id as the product_id and provides a different variable for the product_id allowing the form to return to that parent.

This works only if you have added the don't display cart modification as detailed at the begining of this post and my mod in the previous post if you are using php4.

Hope this is of use.

Mark

(p.s. currently working on changing this mod to have only one 'add to cart' button to further improve its functionality i.e. update multiple child items with only one click!)
Mark
All of My old mods are now available on my website.
Mark Callf Designs

If you like the work I've done for VM please fell free to Donate

Please Note: I am no longer actively developing or involved with VM development.

cccmikey

  • Guest
Re: MOD: Child list instead of drop down.
« Reply #9 on: March 16, 2006, 03:15:42 am »
I am attempting to change the file ps_product.attributes.php but note that in my install it's called ps_product.attribute.php instead. (Attribute instead of attributes)

 FTP error 553 permission denied when I try to replace the file, even tho it's CHMOD 777. Have asked my parent web host for help.

Is the difference in file name likely to kill anything?

macallf

  • Hero Member
  • *****
  • Posts: 2411
    • Mark Callf Design
Re: MOD: Child list instead of drop down.
« Reply #10 on: March 16, 2006, 03:52:14 am »
Just a silly spelling mistake on my part.

The file is ps_product.attribute.php

Be sure to back up any file you are going to replace before replacing it. That way if there is something wrong with the files you can easily return to the state it was before modifying anything.

Sorry if this is second nature to you, but it does save on headaches later!

Mark
Mark
All of My old mods are now available on my website.
Mark Callf Designs

If you like the work I've done for VM please fell free to Donate

Please Note: I am no longer actively developing or involved with VM development.

cccmikey

  • Guest
Re: MOD: Child list instead of drop down.
« Reply #11 on: March 17, 2006, 06:57:47 am »
Just wanted to say thank you to macallf for writing this mod. I am 1/2 way through installing it and so far it works :) Hoping you are successful in getting the single add item(s) to cart option.

cccmikey

  • Guest
Re: MOD: Child list instead of drop down.
« Reply #12 on: March 17, 2006, 07:50:47 am »
Hmmm.

After adding the mods for not going back to the cart and not going to the child item after clicking to add to cart, I seem to have broken the stock checking component.

Info: The selected quantity exceeds available stock. We currently have 0 items available. [Edit: When stock level checking disabled, error changes to Sorry, but the Product you\'ve requested wasn\'t found!]

Guess I've broken something? Will have to revert to unmodded state.

I've also had an effect (after the first mod) not visible on yours where I also see a dropdown box for the item variations available plus the parent product. This would go away when I was in a child display.

Before Mod:


After Mod:


I'll start again from scratch and see if it works out differently- I might have missed a step.

Cheers, Mike.

...later ...

change line 299 from
Code:
.$ps_product_attribute->list_attribute($product_id)


This occurs on line 281 in my original version, which is
 * @version $Id: shop.product_details.php,v 1.12.2.3 2006/01/18 19:40:59 soeren_nb Exp $

Most other line numbers also do not match up so I am guessing that this mod is not for this version?

...later ...

I re-applied the first part of the mod, and end up again with the same as the second screenshot. It also displays the peculiar behaviour (as before) that if I request more than one ball of green wool (the first in the list) it goes to the cart with only one as the quantity. If I do the same for the blue ball, I get the correct quantity but don't get wheeled off to the cart.

I can see other functions there for showing the dropdown boxes. Perhaps if I killed those off it would behave? Can't help but thinking we have different versions? :)

macallf

  • Hero Member
  • *****
  • Posts: 2411
    • Mark Callf Design
Re: MOD: Child list instead of drop down.
« Reply #13 on: March 17, 2006, 12:49:25 pm »
Hi,

I originally wrote the mod for Version 1.0.2 and have recently upgraded to 1.0.3.

as long as the line .$ps_product_attribute->list_attribute($product_id) is changed to .$ps_product_attribute->list_attribute_list($product_id). The function should work. This is just after
Code: [Select]
/* ADD-TO-CART */
  $addtocart = "<div>
    <form action=\"". $mm_action_url."index.php\" method=\"post\" name=\"addtocart\" id=\"addtocart\">"
          .$ps_product_attribute->list_attribute_list($product_id)

I have made several modifications to my files But I was sure that I done this on a stock version.

The problem with 0 stock and product not found was a problem I encounted when adding the last part of the modification. The mod that keeps the detail page on the parent page.

If the incorrect prod_id or product_id is sent the product can not be found usually because you are trying to purchase a parent item rather that the child item. I would double check this part of the code.

If you want to return back to dropdowns just change the lines that get the attribbute list back to

.$ps_product_attribute->list_attribute($product_id);;

I've also attached the ps_cart file which could be causing the problems.

Mark

[attachment cleanup by admin]
Mark
All of My old mods are now available on my website.
Mark Callf Designs

If you like the work I've done for VM please fell free to Donate

Please Note: I am no longer actively developing or involved with VM development.

cccmikey

  • Guest
Re: MOD: Child list instead of drop down.
« Reply #14 on: March 17, 2006, 13:33:27 pm »
Thanks :) I'll try again in about 12-18 hours and let you know how it goes :)


...later...

Just to confirm that my screenshots were using the code
Quote
/* ADD-TO-CART */
  $addtocart = "<div>
    <form action=\"". $mm_action_url."index.php\" method=\"post\" name=\"addtocart\" id=\"addtocart\">"
          .$ps_product_attribute->list_attribute_list($product_id)
          // added for the advanced attribute modification
          .$ps_product_attribute->list_advanced_attribute($product_id)
          // end added for advanced attribute modification
          .$ps_product_attribute->list_custom_attribute($product_id);
          // end added for custom attribute modification

Would I be correct in guessing tht the list_advanced_attribute and list_custom_attribute are not wanted?

I'll now try the ps_cart.php file you attached :)

...later...
After applying these changes including the new ps_cart.php I am back to produt not found. Reviewing the code, but I fear my lack of programming knowledge will mean I'll have to revert to a 1.0.2 codebase and try again.

...later...

(I'll nuke this post if it's not useful.)

I broke the shop when cPanel suggested an upgrade of Mambo Open Source to Joomla. So, wiped the lot, reinstalled Mambo Open Source, installed the older code base 1.0.2, retained the demo data and am mucking around with it now. I notice with the hammer if I define the extra colours red, green, blue as custom attributes then these items appear in a list as well as the preset options if big little, etc. Have removed the preset attributes from the product and am now to a point of just having the drop-down field for choosing an item. Will now attempt to reapply the mod(s) and see what happens.

...later...

Waiting for parent web hosting provider to change permissions as cPanel file manager blocks any changes to the com_virtuemart folder. (Files are CHMOD 777 but not accessible for changes.) Est wait time 2 hours.