News:

Support the VirtueMart project and become a member

Main Menu

Long report on mods made to 1.1.0 RC2

Started by Nimai, March 20, 2008, 05:43:07 AM

Previous topic - Next topic

Nimai

I apologize if this is the wrong forum to post this.  Some of these might be bugs or feature requests, others are based on my particular needs and goals for my online shop.  When I first used VirtueMart two years ago, I did a lot of hacking in the code to get things just the way I wanted them.  Now, upgrading to Joomla 1.5 and VirtueMart 1.1.0 RC2, I decided to document the things in the code that I needed to change.
My shop is set up for my sons elementary school, for them to sell school supplies online.  I wanted the shop to be as simple as possible.  Many VirtueMart features target large installations (or people that want their shop to seem like a large installation) with things like user reviews, similar items, categories, child items, related items, etc.  I have FIVE items total.  Most of the large-shop features could be turned off through VirtueMart's admin panels, but some could not be.  Others didn't function just right when turned off.
I am pleased with the results I achieved.  Please take a look at my minimalist shop!  Notice how even products with custom attributes and fields can be added to the cart without going to a details page.

http://bceboosterclub.org/bcbc


What follows is a list of files that I modified, and my rational for making the modifications.  If it would help to have any more source code or snippets, please let me know.



basket_b2b.html.php
components/com_virtuemart/themes/default/templates/basket/



Removed the SKU column.  It would be nice if this were an option.  It was a pain to adjust the colspans.
Removed the Tax line if the tax value was zero
Removed the Subtotal line if the amount equaled the total




ro_basket_b2b.html.php
components/com_virtuemart/themes/default/templates/basket/



Removed the SKU column.  It would be nice if this were an option.  It was a pain to adjust the colspans.
Made the Subtotal column and Total cell align="right"
Removed the Tax line if the tax value was zero
Removed the Subtotal line if the amount equaled the total




theme.config.php
components/com_virtuemart/themes/default/



Changed the following: (Can these be changed through Admin UI?)
showAvailability=0
useLightBoxImages=0
useAjaxCartActions=0





minicart.tpl.php
components/com_virtuemart/themes/default/templates/common/



Removed menu_logo.gif image - sorry, guys, it is too large for the minicart




shop.index.php
administrator/components/com_virtuemart/html/



Added logic to redirect to the product list if there is only one category
if( count($category_childs) == 1 ) {
   $url_parameters = URL."index.php?option=com_virtuemart&page=shop.browse&category_id=".$category_childs[0]["category_id"];
   vmRedirect( $sess->url($url_parameters, true, false ) );
}





shop.browse.php
administrator/components/com_virtuemart/html/



Commented out the following lines to get an Add to Cart button no matter what.
   && !stristr( $product_price, $VM_LANG->_('PHPSHOP_PRODUCT_CALL') )
   && !ps_product::product_has_attributes( $db_browse->f('product_id'), true )


Added the following lines so that I can render the custom attributes and user fields.
   $products[$i]['flypage'] = $db_browse->f("category_flypage") ? $db_browse->sf("category_flypage") : FLYPAGE;
   $products[$i]['ps_product_attribute'] = $ps_product_attribute;
   $products[$i]['product_id'] = $db_browse->f('product_id');





theme.css
components/com_virtuemart/themes/default/



Reduced .vmCartContainer and .vmCartChild to have only width: auto;
Added .vmCartModule and .vmCartModule div styles. (These might only be needed by my current Joomla theme, though.)




browse_orderbyform.tpl.php
components/com_virtuemart/themes/default/templates/browse/includes/[/b]


Wrapped the whole thing in a <div style="display:none"> </div> because I didn't see a configuration option to disable the sort control at the top.




price.tpl.php
components/com_virtuemart/themes/default/templates/common/



Changed the price display to echo 'Varies' if the base_price is zero.  I have a product whose price is entirely determined by the properties, and this makes it clear to the customer.




minicart.tpl.php
components/com_virtuemart/themes/default/templates/common/



Replaced formating for minicart to better display user properties and fields minimally.




virtuemart.cfg.php
administrator/components/com_virtuemart/



Hard-coded the value for 'URL' since the $mosConfig_live_site.$app doesn't work for differentiating URL and SECUREURL and Virtuemart would lose the Session information when switching to my shared cert. URL




ps_userfield.php
administrator/components/com_virtuemart/classes/



Added a case block to the listUserFields function switch statement for my custom field names: vm_childone through vm_childfive.




checkout_register_form.php
administrator/components/com_virtuemart/html/



No changes to the file, just a note to self: If you select to not have users agree to a terms of service, there will be no Agreed checkbox, but the User Field 'agreed' is still required.  Make it not-required using Manage User Fields.  Same goes for any delimiters or other User Fields that you don't Show - make sure they're not Required because the javascript alert won't tell you what's wrong.  To debug, I had added output of the $missing variable to the alert.




checkout.index.php
administrator/components/com_virtuemart/html/



I only have the last two checkout steps enabled.  The dynamic page title was displaying "Step 3 of 2" and "Step 4 of 2".  Fixed this.
   // Set Dynamic Page Title: "Checkout: Step x of x"
   $current_step = 1;
   foreach( $checkout_steps as $checkout_step => $step_name ) {
      if( $current_stage == $checkout_step )
         break;
      ++$current_step;
   }
   $mainframe->setPageTitle( sprintf( $VM_LANG->_('VM_CHECKOUT_TITLE_TAG'), $current_step, count($checkout_steps) ));




ps_shopper.php
administrator/components/com_virtuemart/classes/



I tried to edit the Super Admin user info and uncheck Receive System Emails, but I got a bunch of errors trying to save because I didn't have a name, address, etc. filled out.
Trying to find a way to suppress the registration details email that I receive when someone orders.  I have User Registration Type set to No Account Creation.  For now, added to the email check for superadmin:
   if ($row->sendEmail && (VM_REGISTRATION_TYPE != 'NO_REGISTRATION'))
(That check actually didn't work.  Resorted to commenting out the whole block)




Code for custom flypage and browse


/components/com_virtuemart/themes/default/templates/product_details/
flypage_oneliner.tpl.php
<?php if( !defined'_VALID_MOS' ) && !defined'_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' ); ?>

<br style="clear:both;" />
<table style="width: 100%">
  <tbody>
<tr>
<td rowspan="2" valign="top"><?php echo $product_image ?></td>
<td valign="top"><h1><?php echo $product_name ?> <?php echo $edit_link ?></h1><?php echo $product_price_lbl ?><?php echo $product_price ?></td>
<td width="200px"><?php echo $addtocart ?></td>
</tr>
<tr>
<td colspan="2">
<?php echo $product_description ?><br/>
</td>
</tr>
  </tbody>
</table>




/components/com_virtuemart/themes/default/templates/browse/
browse_oneliner.php
<?php if( !defined'_VALID_MOS' ) && !defined'_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' ); ?>
<?php
$addtocart 
$this->fetch('product_details/includes/addtocart_form.tpl.php' );
?>


<br style="clear:both;" />
<table style="width: 100%">
  <tbody>
<tr>
<td rowspan="2" valign="top" width="90px"><img src="<?php echo IMAGEURL ?>product/<?php echo $product_thumb_image ?>" alt="<?php echo $product_name ?>"/></td>
<td valign="top"><h1><?php echo $product_name ?></h1><b>Price:</b><?php echo $product_price ?></td>
<td><?php echo $addtocart ?></td>
</tr>
<tr>
<td colspan="2">
<?php echo $product_s_desc ?><br/>
</td>
</tr>
<tr>
<hr />
</tr>
  </tbody>
</table>

ezflyeruk

Hi

Thanks for sharing.

I've looked at your site - you seem to have cured the problem I am having.

When I go to cart my continue shopping button disappears.  I am using 1.1.0RC3 on Jommla! 1.5

Can you help me with this please?

Also (as you seem to have the styling nailed down) can you indictae how I might get my categories to show as a list (as in rows rather than rows and columns?

many thanks

Ez

JJRO

I see your site has SSL issues on almost every page... was hoping your hardcoded URL would be a fix for me as well - but maybe not.

mazzeddine

Hi

Thanx for sharing your job!
I guess that can help me in organising my virtuemart shop!
My objective is the following:

I have created 2 parameters for a Type of product.

1. These parameters are displayed correctly in the article details (eg. flypage.tpl). see screen_01.jpg

2. I would like to display in the browse page. see screen_02.jpg

Which files do I need to modify?
I will really appreciate your help.

Regards.

Mazzeddine

[attachment cleanup by admin]

ichimonban

Great work, this is very useful.

One question, I've been digging to find how to add custom fields as you have done with your "supplies" product and the "child's full name" field. Do you have any direction on that of which you could share?

Thank you