Showing posts with label virtuemart. Show all posts
Showing posts with label virtuemart. Show all posts

Tuesday, September 17, 2013

How to find all your missing or broken images in Virtuemart

If your store has changed servers or you are just having some file backup issues and are missing your images here is a quick script to tell you which images are broken in virtuemart. This php script could easily be modified for other websites, stores, or tables.

Just change a few variables, upload and it will list out all of your missing product photos. Even with an edit link to help you fix them faster!


 /**
Joomla 1.5 - virtuemart 1.9
lists product large images that are missing and need to be re-uploaded
Thumbnails are auto generated so its not an issue to look for them.
could be easily modified for other datbases/content i.e. categories

*/

//database variables - copy from your configuration.php
$user = '';
$db = '';
$password = '';
$host = 'localhost';
$editurl ='https://www.DOMAIN.com/administrator/index.php?page=product.product_form&limitstart=0&keyword=&product_parent_id=&option=com_virtuemart&product_id=';
 
//make sure you edit your full path here 
$filepath ='/home/DOMAIN/public_html/components/com_virtuemart/shop_image/product';

echo "file location:".$filepath."<br><br>";

if (!$link = mysql_connect($host, $user, $password)) {
    echo 'Could not connect to mysql';
    exit;
}

if (!mysql_select_db($db, $link)) {
    echo 'Could not select database';
    exit;
}
//database query for the fields we need
$sql    = 'SELECT product_id,product_full_image, product_name FROM jos_vm_product';
$result = mysql_query($sql, $link);

if (!$result) {
    echo "DB Error, could not query the database\n";
    echo 'MySQL Error: ' . mysql_error();
    exit;
}

while ($row = mysql_fetch_assoc($result)) 
{
    $filename = $filepath.'/'.$row['product_full_image']; 
    //output the file name and edit link if the file is missing  
    if(!file_exists($filename))
    { 
        echo $row['product_full_image']. ' - '.$row['product_name']  ;
        echo  ' <a href="'.$editurl.$row['product_id'] .'" target="_blank">edit</a><br>';
    }
}

mysql_free_result($result);
exit();
 


Stumble Upon CodePyro

Tuesday, June 19, 2012

Virtuemart Orders Report By Category

Attached is a custom add-on report for InteraMind Reports.

This report finds all of the orders within a date range and outputs the persons name, product information and the Root/Base Category from each product they ordered.

This is a handy report and allows for us to easily import these customers name & email into our preferred email marketing software.

For Example if I made an order with 2 items

Computers -> CPU -> Intel i7x
Software -> Business -> Quickbooks 2012


The resulting csv would look like 

19 June 2012, CodePyro, info@codepyro.com ,Computers
19 June 2012, CodePyro, info@codepyro.com ,Software


Download the Virtuemart Orders Report By Category InteraMind Reports


Stumble Upon CodePyro

Thursday, January 26, 2012

Joomla Virtuemart Product search plugin not finding products

The vmxsearch.plugin that comes with Virtuemart to integrate product search into the normal joomla website search works great once its configured. Some products may not show in the search results.

The main cause for this is if the product is out of stock. In my case I had a -2 in the stock amount for the products that were not showing.

Change this by going into the admin->virtuemart->product list-> edit product and change the stock on the Product Status Tab.


Stumble Upon CodePyro

Tuesday, March 15, 2011

Remove modules from Virtuemart Checkout

In creating a new e-commerce site with K2 the Virtuemart checkout was showing all the homepage modules.

After reading a lot of different overly complex solutions on the forums I created this.

//add this code at the top of your template
global $option;
 
//disable modules for virtuemart checkout
 $vmpage= 0;
 if($option == 'com_virtuemart')
 {
  $vmpage= 1;
     $mainWidth = "twoL";
 }

//Then for every module position you need to turn off just add && !$vmpage
//example
if($this->countModules('right')  &&  !$vmpage ){}


Stumble Upon CodePyro

Sunday, March 13, 2011

k2mart Creating a module Product Grid

To create your product grid you will need to first setup k2mart custom listing overrides.

Once that is done create a new mod_k2_content module item and add it to your template. My grid is fairly large so it goes in the "bottom" position under the content.

Change module settings

  • Change the "Select sub-template" to your new custom override directory.
  • Select the categories or specific items, I chose categories to make it simple
  • Configure all of the things you would like to show, I turned off everything but the image; all of the items prices and names come from the k2mart plugin so we dont need any of the k2 items properties

!important: Before saving your module, make sure to enable k2 plugins under advanced in the module. Or k2mart will not load.

Now that your module is all setup we can make grid changes. Open up Template/html/mod_k2_content/CUSTOM_OVERRIDE/default.php file to alter the default list behavior. In this file you will find that the k2 items are setup in an HTML list.

Add a class of "productGrid" to the UL and "boxItem" to the LI.
//around line 20
<ul class="productGrid">
    <?php foreach ($items as $key=>$item):  
//around line 26 
<li class="<?php echo ($key%2) ? "odd" : "even"; if(count($items)==$key+1) echo ' lastItem'; ?> boxItem">

Now go adjust your template style sheets to get the list items to behave as a grid. I wanted all of my k2 items in a box format to fit 4 items per row. To do this I made each list item a block with a width and padding to ensure they would fit in 980px.
.productGrid li.boxItem
{  
    color:#D76024;     
    display:block; 
    float:left; 
    font-weight:bold;
    font-size:14px !important;
    padding:5px 20px 5px 20px;
    width:200px;
}

Now we have a grid of our products but the k2 mart product boxes are ugly. Lets go fix that too.

Open up the custom override TEMPLATE/html/k2mart/module.php
Change the module.php k2mart class from class="itemVmFields" to class="itemGrid".

To get my desired look of Product Name, then Image, then Price, I copied over the image display from the mod_k2_content file. As you can see I removed the LI item for the product name and put it into an h4 tag before the image.

//K2mart STARTS HERE
<div class="itemGrid"> 

//moved product name into h4
 <?php if($this->params->get('moduleProductName') && !empty($product->name)): ?>
         <h4 >
            <span class="itemLabel"><?php echo JText::_('Name'); ?>:</span>
            <span class="itemValue"><?php echo $product->name; ?></span>
         </h4>
<?php endif; ?>

//Image code pulled from mod_k2_content/default.php        
 <?php if(isset($item)):?>
     <div class="moduleItemIntrotext">
            <a class="moduleItemImage" href="<?php echo $item->link; ?>" title="<?php echo JText::_('Continue reading'); ?> &quot;<?php echo K2HelperUtilities::cleanHtml($item->title); ?>&quot;">
              <img src="<?php echo $item->image; ?>" alt="<?php echo $item->title; ?>"/>
          </a>
       </div>
 <?php endif;?> 
    <ul> 

Now lets play with our style sheets for the k2mart items in our grid
.itemGrid ul { margin:0px; padding:0px;}
.itemGrid ul li{ margin:0px; padding:0px; height:auto; list-style:none;}
.itemGrid h4{ color:#AAA;}

Of course then I played with buttons and text styles, but hey its a start.

Final Results:


Stumble Upon CodePyro

Wednesday, March 02, 2011

CSVI virtuemart google base export Tax's changes

Google base import has changed their tax format for product import, to implement these changes in Virtuemart CSVI export you need to make some code changes.

  1. Change the Default fields in the google base export
    1. Change the custom field g:tax_region to g:tax and give it your required values semi-colon separated in the format of (Country:Region:Rate) i.e. "US:Colorado:5.00"
  2. Remove the custom field g:tax_percent

around line 113 in csvi_class_xml_froogle.php in the file
administrator/com_csviimproved/helpers/xml
add the following case to the function ContentText


case 'g:tax':
                        list($country, $service, $rate) = split(":", $content);
                        $this->contents = '
                        <g:country>'.$country.'</g:country>
                        <g:region>'.$service.'</g:region>
                        <g:rate>'.$rate.'</g:rate>
                        <g:tax_ship>n</g:tax_ship>
                        ';
                    break;


Stumble Upon CodePyro

Monday, December 20, 2010

virtuemart: Enable Billing information in Order Review page

Quick script to paste into the virtuemart checkout confirmation page to show the billing information under the shipping info.

Step 1:
Search for "if(NO_SHIPTO=='')" in your components/com_virutemart/themes/YOURTHEME/templates/checkout/get_final_confirmation.tpl.php

Step 2:
and find the last line that reads
echo "</td></tr>";


Step 3:
Just after that last line paste the below contents.

$db->query("SELECT * FROM #__{vm}_user_info WHERE user_id=".strip_tags($db->f("user_id"))." and address_type='BT'");
    $db->next_record();
 
    
    echo '<tr><td valign="top"><strong>'.$VM_LANG->_('PHPSHOP_ORDER_PRINT_CUST_BILLING_LBL') . ":</strong></td>";
    echo '<td>';
    echo vmFormatAddress( array('name' => $db->f("first_name")." ".$db->f("last_name"),
                                        'address_1' => $db->f("address_1"),
                                        'address_2' => $db->f("address_2"),
                                        'state' => $db->f("state"),
                                        'zip' => $db->f("zip"),
                                        'city' => $db->f("city"),
                                        'country' => $db->f('country')
                                    ), true );
    
    echo "</td></tr>";



Stumble Upon CodePyro

Tuesday, April 06, 2010

FedEx Handling fee as a percent in virtuemart

If your like me, and every client needs something special and different. One of my latest e-commerce stores used FedEx for shipping. Great, no problem its an easy setup in Virtuemart. Their FedEx account gives them special pricing for the online shipping calculator, which they need to add 40% too. Virtuemart doesn't allow you to add a percent only a set integer amount.

The handling fee variable in virtuemart is setup only to add a base amount to the shipping cost. We needed to add 40% to each shipping amount.

This is a change specifically for FedEx, but the other shippers should be similar.

Change the handling fee in the FedEx preferences to 0.40.

components/com_virtuemart/classes/shipping/fedex.php: around line 206
change & add the lines below.

//add the percent or set amount 
if(FEDEX_HANDLINGFEE < 1)
     $charge =$rate_Ret['1419-'.$i]+ $rate_Ret['1419-'.$i] * floatval( FEDEX_HANDLINGFEE );
    else
     $charge = $rate_Ret['1419-'.$i] + floatval( FEDEX_HANDLINGFEE );


Stumble Upon CodePyro

Thursday, March 25, 2010

virtuemart google analytics with ppc

Good morning today we needed to add google analytics to a virtuemart joomla store. Heres how we done it.

Over on joomlacode.org Matthieu Barbe did a great job of creating a google analytics plugin. His plugin will work on every page. It shows the generic google analytics code for normal pages and for the shopping cart finish/confirmation will track a users order, price, items etc.

Visit joomlacode.org to download the original mod_gavirtuemart.

I have requested to join the project, but until that goes through ill post my modifications to the module here.

The module had a bug in several queries with user_info_id using the default or wrong id when a different shipping address is used.

Our SEO consultant Scott Orth for this project recommended setting up google PPC conversion code. To make life easy I added some settings and template for ppc.php to show only on the order thank you/confirmation page.

This is one of my first actual joomla module posts so let me know if it works, or doesn't.
mod_gavirtuemart w ppc


Stumble Upon CodePyro

Wednesday, March 10, 2010

Importing Categories/Products/Sub items with Virtuemart CSVI

Finally after much trial/error/re-dos I finally have a grasp on correctly importing into virtuemart with the CSVI tool. Here is a run down to hopefully make it easier for you aka "me" later.

Note 1: Export your data from your existing store
The default in the CSVI is Carots ^ for field delimiters and tilde ~ to wrap text content.


Step 1:
Go into the CSVI templates and make a template that you can match your data too. Become familiar with the field listings . I ended up using category_path, category_list_order, category_full_image, category_description, category_publish, category_products_per_row, category_flypage.

Category_path -> use this field to setup your structure of parents and children

Make sure your images don't have a path i.e. 'someimg.jpg' not 'images/someimg.jpg' and are copied into the /components/com_virtuemart/shop_image/category/ folder.

Import the categories, then go into virtuemart category list and verify everything is correct

Note 2: make sure your categories are correct!! Every time you re-import your categories it will make new ones instead of overwriting the old ones which also screws up the products linked to the correct category. //BOO!!
Product import will update/overwrite existing products! //YEA!!


Step 2: Prep/import your products.
You need a csv import of products that will be listed under categories/sub-cats. These products will be added directly to your category structure using the category_path field. The Category_id didn't work for me so use the category_path instead. It will be something like 'Computers/hardware'.

Again the images don't need a path and need to be uploaded into /components/com_virtuemart/shop_image/products/

Step 2: Prep/import your sub-products.
Setup a product import with a blank CATEGORY_PATH and have the product_parent_sku setup. This field will need to have the EXACT product_sku of the parent product item.

Note 3: Products with a category path will be listed under the category NOT under the parent product.

Note 4: the product_currency field MUST BE UPPER case i.e. 'USD' otherwise it formats your prices to something random (I didn't bother trying to figure it out it probably uses EUR or something).

Note 5: When importing users, the users must be imported into joomla first then imported into virtuemart


Stumble Upon CodePyro

Wednesday, February 24, 2010

virtuemart addtocart_list_single.tpl.php on line 38

If you are getting an attributes error in virtuemart with child products on line 38. Just open the file and add an if isset to the attributes around the foreach statement.

likea-so


if(isset($product['attrib_value']))
{
foreach($product['attrib_value'] as $attribute) { ?>
<span class="vmChildDetail<?php echo $cls_suffix ?>" style="width :<?php echo $attrib_width ?>;" />
<?php echo " ".$attribute ?></span>
<?php
}
}


Stumble Upon CodePyro