Author Topic: Extension upgrade to support VM2  (Read 2048 times)

stalsoft

  • Beginner
  • *
  • Posts: 1
Extension upgrade to support VM2
« on: February 13, 2012, 16:36:36 pm »
Hi all,

I am the developer of the GoodRelations extension for Virtuemart/Joomla. To date, the extension only works with Joomla 1.5 and Virtuemart 1.1.*, but that should change of course ;-)

Until now I was able to port all the backend stuff of the extension to the new version of Virtuemart and Joomla: http://code.google.com/p/goodrelations-for-joomla/source/browse/v3/mod_goodrelations/

What I still have difficulties with are the global variables of the new Virtuemart version, e.g. to figure out the string for the canonical shop URL (find out whether it is http://www.example.com/shop/ or http://shop.example.com/, etc.). There should be something like VM_SHOP_URI.


What I still need to know and for what I require your help:
- canonical shop URL (ideally SEF URL):
   was define("SHOP_URI", preg_replace("/&/i", "&", BASE_URI.preg_replace("/^\//i", "", str_replace(JURI::base(true), "", $sess->url("?option=com_virtuemart")))) );
- image path, e.g. for referencing the URI of vendor logo or product images:
   was define("IMAGEBASEPATH", BASE_URI.preg_replace("/^\//i", "", str_replace(JPATH_BASE, "", IMAGEPATH)));
- information on whether value added tax is included or not
   was $auth["show_price_including_tax"]

In addition, can I get all the following values that I need from the product class or should I better go with a MySQL query, 1. in terms of coverage, and 2. from a performance point of view? I filled in some values already:
            "product_name"=>$product->product_name,
            "category_uri"=>"self:category_".$category_id,
            "product_short"=>$product->product_s_desc,
            "product_long"=>$product->product_desc,
            "language"=>$lang,
            "company_uri"=>SHOP_URI."#company_data", // TODO
            "stock_level"=>number_format(max($product->product_in_stock, 0), 2, ".", ""),
            "product_type"=>($params->get('offer_individuals')?"gr:Individual":"gr:SomeItems"),
            "product_uri"=>$product->product_url,
            "valid_from"=>$product->product_available_date,
            "valid_through"=>$product->product_available_date, // TODO
            "product_image_uri"=>"", // TODO
            "product_thumbnail_uri"=>"", // TODO
            "sku"=>$product->product_sku,
            "manufacturer_uri"=>"", // TODO
            "vat"=>$auth["show_price_including_tax"],
            "weight"=>$product->product_weight,
            "width"=>$product->product_width,
            "length"=>$product->product_length,
            "height"=>$product->product_height,
            "prefixes"=>array("ns_prefix"=>"self", "ns_uri"=>SHOP_URI."#"), // TODO
            "uom"=>array("weight"=>$product->product_weight_uom, "lwh"=>$product->product_lwh_uom),
            "features"=>array(), // TODO
            "price"=>$product->product_price, // TODO
            "currency"=>$product->product_currency, // TODO
            "price_quantity_start"=>"", // TODO
            "price_quantity_end"=>"", // TODO
            "business_function"=>"", // TODO
            "eligible_regions"=>array(), // TODO

Once I know these things I can finalize the extension and provide a new release compatible with VM2 and Joomla 2.5!
Thanks in advance for your help.

Best wishes,
Alex