Skip to content

Instantly share code, notes, and snippets.

@enminc
Created June 28, 2011 17:53
Show Gist options
  • Save enminc/1051715 to your computer and use it in GitHub Desktop.
Save enminc/1051715 to your computer and use it in GitHub Desktop.
Temporary Fix for VisionCart "vcGetProductCustomField" Snippet. The changes to this snippet have been logged in big tracker
<?php
/**
* @package visioncart
*/
$vc =& $modx->visioncart;
# !!! FIXED: Fixed statement to be !isset rather then isset
#####################################################
if (!isset($scriptProperties['id']) || !is_numeric($scriptProperties['id'])) {
return '';
}
$product = $vc->getProduct($scriptProperties['id']);
if ($product == null) {
return '';
}
$link = $product->getOne('ProductCategory');
$product = $product->toArray();
# !!! FIXED: Without this $link will never resolve bellow
#########################################################
$link = $link->toArray();
if ($product['customfields'] != '' && is_array($product['customfields'])) {
if (isset($product['customfields'][$link['categoryid']][$field])) {
return $product['customfields'][$link['categoryid']][$field];
}
}
return '';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment