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

macallf

  • Full Member
  • ***
  • Posts: 2411
    • Mark Callf Design
Re: MOD: Child list instead of drop down.
« Reply #15 on: March 18, 2006, 04:31:26 am »
You would be wrong in guessing that the list_advanced_attribute and list_custom_attribute are not wanted?
They are!!!

It's hard to tell where it is going wrong. Have you got a link to a live site? If not I've included ps_product.attribute.php and shop.browse_detail.php and shop.browse.php files.
They are modified to work with V 1.0.3

These are stock files that I have modified and tested with my site and they work fine.

Give them a try and see if it helps.

Mark.
(Dont forget to back up your files before you try them)

[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 #16 on: March 18, 2006, 04:40:05 am »
Hi Mark :)

As posted above, I killed the live site when an experiment went wrong, so am starting again from 1.0.2 code. Once I get it working in 1.0.2 I'll do another install in a separate location to 1.0.3 and see what happens then :) Since this is the first time I've tried to use VirtueMart, I could well have stuffed something myself. (I've only built one shop before, it was a standard osCommerce site - we have to start somewhere!)

macallf

  • Full Member
  • ***
  • Posts: 2411
    • Mark Callf Design
Re: MOD: Child list instead of drop down.
« Reply #17 on: March 18, 2006, 04:49:57 am »
Hi cccmikey,

Have you thought about loading Apachce, mysql and php on your local machine and test there. Once it works how you want upload to your host. (I'm running XP so it works in nearly all formats i.e. linux,XP,MAC). This just saves a lot of headaches.

I know it works I've tested it heavily included another screen shot.

Im using:
  • Joomla 1.0.8
  • VirtueMart 1.0.3
If I can help at all....

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 #18 on: March 18, 2006, 05:10:18 am »
Hmm I never thought of that before :) Have downloaded & Installed Apache, waiting for 40MB of MySQL and will see what happens next! (512k DSL)

cccmikey

  • Guest
Re: MOD: Child list instead of drop down.
« Reply #19 on: March 18, 2006, 06:55:04 am »
Installed Apache, PHP4 (since that's what the host is using) and MySQL on XP SP2. Got to a point of installing Mambo and told my sql username and password is not correct. Tried various combinations of root, michael, etc. and in the MySQL console creating a user and granting it permissions. Kinda stuck now :( Any tips appreciated :) No response from host to last email. Will keep reading help files.

...later...

I spent a few hours but never got a happy combination of the three separate packages. From reading online looks like it's possible to get combo packages that do it in one hit whreas downloading and installing each part seems to be a bit of a nightmare. I'll come back to that at another time. The host has got back to me so I can try changing 1.0.2 now :)

cccmikey

  • Guest
Re: MOD: Child list instead of drop down.
« Reply #20 on: March 18, 2006, 08:57:12 am »
I've gone back to Code base 1.0.2 but note that the line numbers still don't match yours.

I've applied just the first mod to replace the dropdown box, but it's doing the same as it did with the 1.0.3 code - as evidenced on

http://blacksheepwool.com.au/shop/index.php?page=shop.product_details&flypage=&product_id=6&category_id=1&option=com_virtuemart&Itemid=1

(A search for hammer)



I've attached the two patched versions of my files.


...later...

I have another test site using 1.0.3 so I'll try the files you posted earlier.
Waiting for the hosts again...

[attachment cleanup by admin]

cccmikey

  • Guest
Re: MOD: Child list instead of drop down.
« Reply #21 on: March 18, 2006, 09:44:16 am »
I took the three files you had in drop_mod.zip and applied them (and only them) to a VirtueMart 1.0.3 install inside a Mambo install at auzzie.net/shop

Now, all I get is (from www.auzzie.net/shop when clicking a product category)

Fatal error: Call to a member function on a non-object in /home/mccmikey/public_html/shop/administrator/components/com_virtuemart/html/shop.browse.php on line 37

Was that code OK with PHP 4.4.0?

I don't deny at all that you have it working!  I'm happy to give you access to one of the sites if you want to have a play yourself. Perhaps there's something about this shared server that it doesn't like...


macallf

  • Full Member
  • ***
  • Posts: 2411
    • Mark Callf Design
Re: MOD: Child list instead of drop down.
« Reply #22 on: March 18, 2006, 13:39:01 pm »
Hi cccmikey,

The first site you mention seems to be working apart from the extra add to cart button.

This is because the way I have designed this mod. It expects the parent product to have no price associated with it.

Because there is a price it displays the extra add to cart field. I'll see what I can do to get around this!

The second site is looking for the keyword search variable this is a modification in 1.0.3, did the site work before you applied my patch?

Will keep you posted.

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

  • Full Member
  • ***
  • Posts: 2411
    • Mark Callf Design
Re: MOD: Child list instead of drop down.
« Reply #23 on: March 18, 2006, 14:02:18 pm »
Hi again cccmikey,

Found the problem, it is what I expected. I have now added a query to test if the parent has child items.

If it has child items the extra button will not be displayed.

about line 308 in shop.product_details.php
Code: [Select]
if (USE_AS_CATALOGUE != '1' && $db->num_rows() == 0 && $product_price != "" && ($db_product->f("product_parent_id")) == '0' && !stristr( $product_price, $VM_LANG->_PHPSHOP_PRODUCT_CALL )) {

change this to
Code: [Select]
$q = "SELECT product_id,product_name,product_parent_id FROM #__{vm}_product WHERE product_parent_id='$product_id' AND product_publish='Y'";
$db->setQuery($q);
$db->query();

if (USE_AS_CATALOGUE != '1' && !$db->num_rows()  && $product_price != "" && ($db_product->f("product_parent_id")) == '0' && !stristr( $product_price, $VM_LANG->_PHPSHOP_PRODUCT_CALL )) {

And in shop.browse.php about line 408 change
Code: [Select]
if (USE_AS_CATALOGUE != '1' && $db->num_rows() == 0 && $product_price != "" && ($db_product->f("product_parent_id")) == '0' && !stristr( $product_price, $VM_LANG->_PHPSHOP_PRODUCT_CALL )) {
to

Code: [Select]
$product_id = $db_browse->f("product_id");
        $q = "SELECT product_id,product_name,product_parent_id FROM #__{vm}_product WHERE product_parent_id='$product_id' AND product_publish='Y'";
$db->setQuery($q);
$db->query();
/*** Add-to-Cart Button ***/
if (USE_AS_CATALOGUE != '1' && !$db->num_rows() && $product_price != "" && !stristr( $product_price, $VM_LANG->_PHPSHOP_PRODUCT_CALL )) {

the query checks for child items and the condition statement checks that there are no child items.

Difficult to check the second site, if it does work without the modded files added it would seem that it is not a 1.0.3 virtumart site.

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 #24 on: March 18, 2006, 20:15:30 pm »
Hehe I never thought of that re. the parent having a price when it shouldn't! I'll go shortly and try that out.


about line 308 in shop.product_details.php
Code: [Select]
if (USE_AS_CATALOGUE != '1' && $db->num_rows() == 0 && $product_price != "" && ($db_product->f("product_parent_id")) == '0' && !stristr( $product_price, $VM_LANG->_PHPSHOP_PRODUCT_CALL )) {



My site has
Code: [Select]
if (USE_AS_CATALOGUE != '1' && $product_price != "" && ($db_product->f("product_parent_id")) == '0' && !stristr( $product_price, $VM_LANG->_PHPSHOP_PRODUCT_CALL )) {
instead - because it's a 1.0.2. I'll try the 0 price on parent first and then if that doesn't fix it, I'll decide then whether to upgrade the site to 1.0.3 and then try the patches again, or try them in the 1.0.2 code first. :)
Second Server was Your VirtueMart version: VirtueMart 1.0.3 stable  [Little Red Rooster]
10/03/2006 20:21 GMT. Since it was a forgotten experimental site, I might have broken it somewhat earlier, so my apologies.

cccmikey

  • Guest
Re: MOD: Child list instead of drop down.
« Reply #25 on: March 18, 2006, 20:38:53 pm »
Yay! When I created a new parent item with empty price, then created the child items, it worked perfectly! (I note that once you give something a price, the tax calculation script makes it impossible to delete the zero from both 'amount' and 'tax' fields!)

On the product list it shows price as "Call for Pricing" but I imagine there's an easy way to remove that line.

Going to grab some more sleep now! The rest of the modding can wait :)

macallf

  • Full Member
  • ***
  • Posts: 2411
    • Mark Callf Design
Re: MOD: Child list instead of drop down.
« Reply #26 on: March 18, 2006, 20:50:12 pm »
Hi cccmikey,

sleep, whats that!!!

The previous mod should work on any version!!

The mail to link is in classes/ps_product.php

Code: [Select]
function show_price( $product_id, $hide_tax = false ) {
global $VM_LANG, $CURRENCY_DISPLAY,$vendor_mail;
$auth = $_SESSION['auth'];

$product_name = htmlentities( $this->get_field($product_id, 'product_name'), ENT_QUOTES );
$no_price_html = "&nbsp;<a href=\"mailto:$vendor_mail?subject=".$VM_LANG->_PHPSHOP_PRODUCT_CALL.": $product_name\">".$VM_LANG->_PHPSHOP_PRODUCT_CALL."</a>";

Which I have changed to
   
Code: [Select]
function show_price( $product_id, $hide_tax = false ) {
global $VM_LANG, $CURRENCY_DISPLAY,$vendor_mail;
$auth = $_SESSION['auth'];

$product_name = htmlentities( $this->get_field($product_id, 'product_name'), ENT_QUOTES );

                $no_price_html = "$VM_LANG->_PHPSHOP_PRODUCT_CALL.";
This is about line 1922

I also changed the language file. Look for _PHPSHOP_PRODUCT_CALL this is set to call for pricing. On my site I have changed this to Various sizes available. You couls also just blank it out so that nothing is displayed!

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

  • Full Member
  • ***
  • Posts: 2411
    • Mark Callf Design
Re: MOD: Child list instead of drop down.
« Reply #27 on: March 19, 2006, 04:53:25 am »
Earlier I posted how to correct the don't show cart mod. I have found a side effect in this that throws up errors if you link to a category or details page from outside of your site.

The HTTP_REFERER key hasn't been set to remedy this change

To remedy this change

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'];
      }

to

Code: [Select]
if (array_key_exists('HTTP_REFRER',$_SERVER)) {
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 checks that the referer key has been set if it hasn't it doesn't do the checks.

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

  • Full Member
  • ***
  • Posts: 2411
    • Mark Callf Design
Re: MOD: Child list instead of drop down.
« Reply #28 on: March 19, 2006, 17:40:28 pm »
Major update to this mod.

I now have a list of products working with a single add to cart button.
(Please see screenshot below.)

This has been tested with
  • Joomla 1.0.8
  • VirtueMart 1.0.3

The altered files are

  • /classes/ps_cart.php
  • /classes/ps_product.attribute.php
  • /html/shop.browse.php
  • /html/shop.product_details.php
  • /html/basket.php
  • /html/shop.cart.php

The modification relies on child products but retains all the functionality if no child products exist.

The mod changes the way the cart is displayed, it's not!! Not until you select view cart.

Everytime the add to cart button is clicked the items are updated and the quantity fields are updated from the cart contents. You then stay on your current product page not the cart page.
to update the contents just alter the quantity fields.

If using child products, only the parent product page is displayed, which means descriptions, related products etc are taken from the parent.
no need to duplicate descriptions for like products.

The list now has only 1 add to cart button.

The attached file contains both the modified files and a patch file for those that prefer it.

To install just overwrite the files in /administrator/components/com_virtuemart

PLEASE BACKUP YOUR FILES FIRST
SAVES HEADACHES IF SOMETHING GOES WRONG
[/size][/size]

The modified mini cart can be found here http://virtuemart.net/index.php?option=com_smf&Itemid=71&topic=16326.0


New version for 1.0.4 can be found here
http://virtuemart.net/index.php?option=com_smf&Itemid=71&topic=15697.msg37613#msg37613

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. UPDATE Single add to cart button
« Reply #29 on: March 21, 2006, 11:38:05 am »
Hi Mark,

Its good to see that your on top of this mod and not resting until it is perfected......class!

Well I uploaded the files, (but did a backup this time ;D).  I ended up losing visual to the all products.  So basically I could see the list within the orginal virtualmart mod stated the category of products, then I could click on this and get a description of the product category, but would loose all links, images, pricing etc.hmmm. Now could this have anything to do with the existing setup of the product page (it is setup according to the original modification you post at the top) or is that irrelavant as all files are being replaced?
anyways if you want to take the trouble to have a quick look at the site http://www.dermaology.com and assess if it is the existing setup, or just get back to us here.  Excellent work mark.  oh yeah and if you feel you can just log in through my ftp file and update accordingly feel free.  Just for the record folks, I have given access to Mark to my hosting account and ftp with a temporary user name and password.  I want to vouch that he is a man of integrity and honoured me by resolving a previous problem I had with this mod.  ::)