?>
:
      </td>
		<td><input type="text" class="inputbox" onkeyup="updateNet();"
			name="product_price_incl_tax" size="10" /></td>
	</tr>
	<tr>
		<td class="labelcell"> 
			<?php 
echo $VM_LANG->_('PHPSHOP_PRICE_FORM_CURRENCY');
?>
:
      </td>
		<td> 
        <?php 
$ps_html->list_currency("product_currency", $db->sf("product_currency"));
?>
      </td>
	</tr>
	<tr>
		<td class="labelcell"> <?php 
echo $VM_LANG->_('PHPSHOP_PRICE_FORM_GROUP');
?>
:
      </td>
		<td><?php 
echo ps_shopper_group::list_shopper_groups("shopper_group_id", $db->sf("shopper_group_id"));
?>
      </td>
	</tr>
	<tr>
Esempio n. 2
0
 function recentProducts($product_id, $maxitems)
 {
     global $db, $VM_LANG, $sess;
     if ($maxitems == 0) {
         return;
     }
     $recentproducts = $_SESSION['recent'];
     //No recent products so return empty
     if ($recentproducts['idx'] == 0) {
         //return "";
     }
     $tpl = new $GLOBALS['VM_THEMECLASS']();
     $db = new ps_DB();
     $dbp = new ps_DB();
     $k = 0;
     $recent = array();
     // Iterate through loop backwards (newest to oldest)
     for ($i = $recentproducts['idx'] - 1; $i >= 0; $i--) {
         //Check if on current product and don't display
         if ($recentproducts[$i]['product_id'] == $product_id) {
             continue;
         }
         // If we have not reached max products add the next product
         if ($k < $maxitems) {
             $prod_id = $recentproducts[$i]['product_id'];
             $category_id = $recentproducts[$i]['category_id'];
             $q = "SELECT product_name, category_name, c.category_flypage,product_s_desc,product_thumb_image ";
             $q .= "FROM #__{vm}_product as p,#__{vm}_category as c,#__{vm}_product_category_xref as cx ";
             $q .= "WHERE p.product_id = '{$prod_id}' ";
             $q .= "AND c.category_id = '{$category_id}' ";
             $q .= "AND p.product_id = cx.product_id ";
             $q .= "AND c.category_id=cx.category_id ";
             $q .= "AND p.product_publish='Y' ";
             $q .= "AND c.category_publish='Y' ";
             $q .= "LIMIT 0,1";
             $db->query($q);
             if (!$db->next_record()) {
                 continue;
             }
             if (!$this->is_product($prod_id)) {
                 $prod_id_p = $this->get_field($prod_id, "product_parent_id");
                 $q = "SELECT product_name,category_name, c.category_flypage,product_s_desc,product_thumb_image ";
                 $q .= "FROM #__{vm}_product as p,#__{vm}_category as c,#__{vm}_product_category_xref as cx ";
                 $q .= "WHERE p.product_id = '{$prod_id_p}' ";
                 $q .= "AND c.category_id = '{$category_id}' ";
                 $q .= "AND p.product_id = cx.product_id ";
                 $q .= "AND c.category_id=cx.category_id LIMIT 0,1";
                 $dbp->query($q);
             }
             $recent[$k]['product_s_desc'] = $db->f("product_s_desc");
             if ($recent[$k]['product_s_desc'] == "" && !empty($prod_id_p)) {
                 $recent[$k]['product_s_desc'] = $dbp->f("product_s_desc");
             }
             $flypage = $db->f("category_flypage");
             if (empty($flypage) && !empty($prod_id_p)) {
                 $flypage = $dbp->sf("category_flypage");
             }
             if (empty($flypage)) {
                 $flypage = FLYPAGE;
             }
             $flypage = str_replace('shop.', '', $flypage);
             $flypage = stristr($flypage, '.tpl') ? $flypage : $flypage . '.tpl';
             $recent[$k]['product_url'] = $sess->url("page=shop.product_details&amp;product_id={$prod_id}&amp;category_id={$category_id}&amp;flypage={$flypage}");
             $recent[$k]['category_url'] = $sess->url("page=shop.browse&amp;category_id={$category_id}");
             $recent[$k]['product_name'] = $db->f("product_name");
             if ($recent[$k]['product_name'] == "" && !empty($prod_id_p)) {
                 $recent[$k]['product_name'] = $dbp->f("product_name");
             }
             $recent[$k]['product_name'] = shopMakeHtmlSafe($recent[$k]['product_name']);
             $recent[$k]['category_name'] = $db->f("category_name");
             if ($recent[$k]['category_name'] == "" && !empty($prod_id_p)) {
                 $recent[$k]['category_name'] = $dbp->f("category_name");
             }
             $recent[$k]['product_thumb_image'] = $db->f("product_thumb_image");
             if ($recent[$k]['product_thumb_image'] == "" && !empty($prod_id_p)) {
                 $recent[$k]['product_thumb_image'] = $dbp->f("product_thumb_image");
             }
             $k++;
         }
     }
     if ($k == 0) {
         return "";
     }
     $tpl->set("recent_products", $recent);
     return $tpl->fetch('common/recent.tpl.php');
 }
Esempio n. 3
0
    /**
     * This allows us to print the user fields on
     * the various sections of the shop
     *
     * @param array $rowFields An array returned from ps_database::loadObjectlist
     * @param array $skipFields A one-dimensional array holding the names of fields that should NOT be displayed
     * @param ps_DB $db A ps_DB object holding ovalues for the fields
     * @param boolean $startform If true, print the starting <form...> tag
     */
    function listUserFields($rowFields, $skipFields = array(), $db = null, $startForm = true)
    {
        global $mm_action_url, $ps_html, $VM_LANG, $my, $default, $mainframe, $vm_mainframe, $vendor_country_3_code, $mosConfig_live_site, $mosConfig_absolute_path, $page;
        $dbf = new ps_DB();
        if ($db === null) {
            $db = new ps_DB();
        }
        $default['country'] = $vendor_country_3_code;
        $missing = vmGet($_REQUEST, 'missing', '');
        // collect all required fields
        $required_fields = array();
        foreach ($rowFields as $field) {
            if ($field->required == 1) {
                $required_fields[$field->name] = $field->type;
            }
            $allfields[$field->name] = $field->name;
        }
        foreach ($skipFields as $skip) {
            unset($required_fields[$skip]);
        }
        // Form validation function
        if (!vmIsAdminMode()) {
            ps_userfield::printJS_formvalidation($required_fields, $rowFields);
        } else {
            echo vmCommonHTML::scriptTag('', 'function submitregistration() { return true }');
        }
        if (file_exists($mosConfig_absolute_path . '/includes/js/mambojavascript.js')) {
            $vm_mainframe->addScript('includes/js/mambojavascript.js');
        }
        if ($startForm) {
            echo '<form action="' . $mm_action_url . basename($_SERVER['PHP_SELF']) . '" method="post" name="adminForm">';
        }
        echo '
		<div style="width:90%;">';
        if (!empty($required_fields)) {
            echo '<div style="padding:5px;text-align:center;"><strong>(* = ' . $VM_LANG->_('CMN_REQUIRED') . ')</strong></div>';
        }
        $delimiter = 0;
        foreach ($rowFields as $field) {
            if (!isset($default[$field->name])) {
                $default[$field->name] = $field->default;
            }
            $readonly = $field->readonly ? ' readonly="readonly"' : '';
            if (in_array($field->name, $skipFields)) {
                continue;
            }
            // Title handling.
            $key = $field->title;
            if ($key[0] == '_') {
                $key = substr($key, 1, strlen($key) - 1);
            }
            if ($VM_LANG->exists($key)) {
                $field->title = $VM_LANG->_($key);
            }
            if ($field->name == 'agreed') {
                $field->title = '<script type="text/javascript">//<![CDATA[
				document.write(\'<label for="agreed_field">' . str_replace("'", "\\'", $VM_LANG->_('PHPSHOP_I_AGREE_TO_TOS')) . '</label><a href="javascript:void window.open(\\\'' . $mosConfig_live_site . '/index2.php?option=com_virtuemart&page=shop.tos&pop=1\\\', \\\'win2\\\', \\\'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no\\\');">\');
				document.write(\' (' . $VM_LANG->_('PHPSHOP_STORE_FORM_TOS') . ')</a>\');
				//]]></script>
				<noscript>
					<label for="agreed_field">' . $VM_LANG->_('PHPSHOP_I_AGREE_TO_TOS') . '</label>
					<a target="_blank" href="' . $mosConfig_live_site . '/index.php?option=com_virtuemart&amp;page=shop.tos" title="' . $VM_LANG->_('PHPSHOP_I_AGREE_TO_TOS') . '">
					 (' . $VM_LANG->_('PHPSHOP_STORE_FORM_TOS') . ')
					</a></noscript>';
            }
            if ($field->name == 'username' && VM_REGISTRATION_TYPE == 'OPTIONAL_REGISTRATION') {
                echo '<div class="formLabel">
						<input type="checkbox" id="register_account" name="register_account" value="1" class="inputbox" onchange="showFields( this.checked, new Array(\'username\', \'password\', \'password2\') );if( this.checked ) { document.adminForm.remember.value=\'yes\'; } else { document.adminForm.remember.value=\'yes\'; }" checked="checked" />
					</div>
					<div class="formField">
						<label for="register_account">' . $VM_LANG->_('VM_REGISTER_ACCOUNT') . '</label>
					</div>
					';
            } elseif ($field->name == 'username') {
                echo '<input type="hidden" id="register_account" name="register_account" value="1" />';
            }
            // a delimiter marks the beginning of a new fieldset and
            // the end of a previous fieldset
            if ($field->type == 'delimiter') {
                if ($delimiter > 0) {
                    echo "</fieldset>\n";
                }
                if (VM_REGISTRATION_TYPE == 'SILENT_REGISTRATION' && $field->title == $VM_LANG->_('PHPSHOP_ORDER_PRINT_CUST_INFO_LBL') && $page == 'checkout.index') {
                    continue;
                }
                echo '<fieldset>
				     <legend class="sectiontableheader">' . $field->title . '</legend>
';
                $delimiter++;
                continue;
            }
            echo '<div id="' . $field->name . '_div" class="formLabel ';
            if (stristr($missing, $field->name)) {
                echo 'missing';
            }
            echo '">';
            echo '<label for="' . $field->name . '_field">' . $field->title . '</label>';
            if (isset($required_fields[$field->name])) {
                echo '<strong>* </strong>';
            }
            echo ' </div>
	      <div class="formField" id="' . $field->name . '_input">' . "\n";
            /**
             * This is the most important part of this file
             * Here we print the field & its contents!
             */
            switch ($field->name) {
                case 'title':
                    $ps_html->list_user_title($db->sf('title'), "id=\"title_field\"");
                    break;
                case 'country':
                    if (in_array('state', $allfields)) {
                        $onchange = "onchange=\"changeStateList();\"";
                    } else {
                        $onchange = "";
                    }
                    $ps_html->list_country("country", $db->sf('country'), "id=\"country_field\" {$onchange}");
                    break;
                case 'state':
                    echo $ps_html->dynamic_state_lists("country", "state", $db->sf('country'), $db->sf('state'));
                    echo "<noscript>\n";
                    $ps_html->list_states("state", $db->sf('state'), "", "id=\"state_field\"");
                    echo "</noscript>\n";
                    break;
                case 'agreed':
                    echo '<input type="checkbox" id="agreed_field" name="agreed" value="1" class="inputbox" />';
                    break;
                case 'password':
                case 'password2':
                    echo '<input type="password" id="' . $field->name . '_field" name="' . $field->name . '" size="30" class="inputbox" />' . "\n";
                    break;
                default:
                    switch ($field->type) {
                        case 'date':
                            echo vmCommonHTML::scriptTag($mosConfig_live_site . '/includes/js/calendar/calendar.js');
                            if (vmIsJoomla('1.5', '>=')) {
                                // in Joomla 1.5, the name of calendar lang file is changed...
                                echo vmCommonHTML::scriptTag($mosConfig_live_site . '/includes/js/calendar/lang/calendar-en-GB.js');
                            } else {
                                echo vmCommonHTML::scriptTag($mosConfig_live_site . '/includes/js/calendar/lang/calendar-en.js');
                            }
                            echo vmCommonHTML::linkTag($mosConfig_live_site . '/includes/js/calendar/calendar-mos.css');
                            $maxlength = $field->maxlength ? 'maxlength="' . $field->maxlength . '"' : '';
                            echo '<input type="text" id="' . $field->name . '_field" name="' . $field->name . '" size="' . $field->size . '" value="' . ($db->sf($field->name) ? $db->sf($field->name) : '') . '" class="inputbox" ' . $maxlength . $readonly . ' />' . "\n";
                            echo '<input name="reset" type="reset" class="button" onclick="return showCalendar(\'' . $field->name . '_field\', \'y-mm-dd\');" value="..." />';
                            break;
                        case 'text':
                        case 'emailaddress':
                        case 'webaddress':
                        case 'euvatid':
                            $maxlength = $field->maxlength ? 'maxlength="' . $field->maxlength . '"' : '';
                            echo '<input type="text" id="' . $field->name . '_field" name="' . $field->name . '" size="' . $field->size . '" value="' . ($db->sf($field->name) ? $db->sf($field->name) : '') . '" class="inputbox" ' . $maxlength . $readonly . ' />' . "\n";
                            break;
                        case 'textarea':
                            echo '<textarea name="' . $field->name . '" id="' . $field->name . '_field" cols="' . $field->cols . '" rows="' . $field->rows . '" ' . $readonly . '>' . $db->sf($field->name) . '</textarea>';
                            break;
                        case 'editorta':
                            editorArea($field->name, $db->sf($field->name), $field->name, '300', '150', $field->cols, $field->rows);
                            break;
                        case 'checkbox':
                            echo '<input type="checkbox" name="' . $field->name . '" id="' . $field->name . '_field" value="1" ' . ($db->sf($field->name) ? 'checked="checked"' : '') . '/>';
                            break;
                        case 'age_verification':
                            $year = vmRequest::getInt('birthday_selector_year', date('Y'));
                            if ($db->f($field->name)) {
                                $birthday = $db->f($field->name);
                                $date_array = explode('-', $birthday);
                                $year = $date_array[0];
                                $month = $date_array[1];
                                $day = $date_array[2];
                            }
                            ps_html::list_days('birthday_selector_day', vmRequest::getInt('birthday_selector_day', @$day));
                            ps_html::list_month('birthday_selector_month', vmRequest::getInt('birthday_selector_month', @$month));
                            ps_html::list_year('birthday_selector_year', $year, $year - 100, $year);
                            break;
                        case 'captcha':
                            if (file_exists($mosConfig_absolute_path . '/administrator/components/com_securityimages/client.php')) {
                                include $mosConfig_absolute_path . '/administrator/components/com_securityimages/client.php';
                                // Note that this package name must be used on the validation side too! If both are not equal, validation will fail
                                $packageName = 'securityVMRegistrationCheck';
                                echo insertSecurityImage($packageName);
                                echo getSecurityImageText($packageName);
                            } else {
                                if (file_exists($mosConfig_absolute_path . '/plugins/system/securityimages.php')) {
                                    echo "<script type=\"text/javascript\" src=\"" . JURI::root() . "/components/com_securityimages/js/securityImages.js\"></script>";
                                    echo "<img id='captchaSecurityImages' name='captchaSecurityImages' src=\"" . JURI::root() . "/index.php?option=com_securityimages&task=displayCaptcha\" />";
                                    echo "<a href=\"javascript:askNewSecurityImages('captchaSecurityImages');\">";
                                    echo "<img src=\"" . JURI::root() . "/components/com_securityimages/buttons/reload.gif\" id=\"securityImagesContactCaptchaReload\" name=\"securityImagesContactCaptchaReload\" border=\"0\">";
                                    echo "</a>";
                                    echo "<input type=\"text\" name=\"securityVMRegistrationCheck_try\" />";
                                }
                            }
                            break;
                            // Begin of a fallthrough
                        // Begin of a fallthrough
                        case 'multicheckbox':
                        case 'select':
                        case 'multiselect':
                        case 'radio':
                            $k = $db->f($field->name);
                            $dbf->setQuery("SELECT fieldtitle,fieldvalue FROM #__{vm}_userfield_values" . "\n WHERE fieldid = " . $field->fieldid . "\n ORDER BY ordering");
                            $Values = $dbf->loadObjectList();
                            $multi = "";
                            $rowFieldValues['lst_' . $field->name] = '';
                            if ($field->type == 'multiselect') {
                                $multi = "multiple='multiple'";
                            }
                            if (count($Values) > 0) {
                                if ($field->type == 'radio') {
                                    $rowFieldValues['lst_' . $field->name] = vmCommonHTML::radioListTable($Values, $field->name, 'class="inputbox" size="1" ', 'fieldvalue', 'fieldtitle', $k, $field->cols, $field->rows, $field->size, $field->required);
                                } else {
                                    $ks = explode("|*|", $k);
                                    $k = array();
                                    foreach ($ks as $kv) {
                                        $k[]->fieldvalue = $kv;
                                    }
                                    if ($field->type == 'multicheckbox') {
                                        $rowFieldValues['lst_' . $field->name] = vmCommonHTML::checkboxListTable($Values, $field->name . "[]", 'class="inputbox" size="' . $field->size . '" ' . $multi, 'fieldvalue', 'fieldtitle', $k, $field->cols, $field->rows, $field->size, $field->required);
                                    } else {
                                        $rowFieldValues['lst_' . $field->name] = vmCommonHTML::selectList($Values, $field->name . "[]", 'class="inputbox" size="' . $field->size . '" ' . $multi, 'fieldvalue', 'fieldtitle', $k);
                                    }
                                }
                            }
                            // no break! still a fallthrough
                            echo $rowFieldValues['lst_' . $field->name];
                            break;
                    }
                    break;
            }
            if ($field->description != '') {
                echo vmToolTip($field->description);
            }
            echo '<br /></div>
				      <br style="clear:both;" />';
        }
        if ($delimiter > 0) {
            echo "</fieldset>\n";
        }
        echo '</div>';
        if (VM_REGISTRATION_TYPE == 'OPTIONAL_REGISTRATION') {
            echo '<script type="text/javascript">
		   function showFields( show, fields ) {
		   	if( fields ) {
		   		for (i=0; i<fields.length;i++) {
		   			if( show ) {
		   				document.getElementById( fields[i] + \'_div\' ).style.display = \'\';
		   				document.getElementById( fields[i] + \'_input\' ).style.display = \'\';
		   			} else {
		   				document.getElementById( fields[i] + \'_div\' ).style.display = \'none\';
		   				document.getElementById( fields[i] + \'_input\' ).style.display = \'none\';
		   			}
		   		}
		   	}
		   }
		   try {
		   	showFields( document.getElementById( \'register_account\').checked, new Array(\'username\', \'password\', \'password2\') );
		   } catch(e){}
		   </script>';
        }
    }
Esempio n. 4
0
    $mainframe->setPageTitle($db->f("category_name"));
    $desc = $ps_product_category->get_description($category_id);
    $desc = vmCommonHTML::ParseContentByPlugins($desc);
    /* Prepend Product Short Description Meta Tag "description" when applicable */
    $mainframe->prependMetaTag("description", substr(strip_tags($desc), 0, 255));
}
// when nothing has been found we tell this here and say goodbye
if ($num_rows == 0 && (!empty($keyword) || !empty($keyword1))) {
    echo $VM_LANG->_('PHPSHOP_NO_SEARCH_RESULT');
} elseif ($num_rows == 0 && empty($product_type_id) && !empty($child_list)) {
    echo $VM_LANG->_('EMPTY_CATEGORY');
} elseif ($num_rows == 1 && (!empty($keyword) || !empty($keyword1))) {
    // If just one product has been found, we directly show the details page of it
    $db_browse->query($list);
    $db_browse->next_record();
    $flypage = $db_browse->sf("category_flypage") ? $db_browse->sf("category_flypage") : FLYPAGE;
    $url_parameters = "page=shop.product_details&amp;flypage={$flypage}&amp;product_id=" . $db_browse->f("product_id") . "&amp;category_id=" . $db_browse->f("category_id");
    vmRedirect($sess->url($url_parameters, true, false));
} else {
    // NOW START THE PRODUCT LIST
    $tpl = vmTemplate::getInstance();
    if ($category_id) {
        /**
         * CATEGORY DESCRIPTION
         */
        $browsepage_lbl = $category_name;
        $tpl->set('browsepage_lbl', $browsepage_lbl);
        $tpl->set('desc', $desc);
        $category_childs = $ps_product_category->get_child_list($category_id);
        $tpl->set('categories', $category_childs);
        $navigation_childlist = $tpl->fetch('common/categoryChildlist.tpl.php');
Esempio n. 5
0
     // Date & Time
 // Date & Time
 case "A":
     // Date
 // Date
 case "M":
     // Time
     echo "    <input type=\"text\" class=\"inputbox\"  name=\"product_type_" . $product_type_id . "_" . $dbpt->f("parameter_name") . "\" value=\"" . $dbp->f($dbpt->f("parameter_name")) . "\" size=\"20\" />";
     break;
 case "T":
     // Text
 // Text
 case "S":
     // Short Text
     echo "<textarea class=\"inputbox\" name=\"product_type_" . $product_type_id . "_" . $dbpt->f("parameter_name") . "\" cols=\"35\" rows=\"6\" >";
     echo $dbp->sf($dbpt->f("parameter_name")) . "</textarea>";
     break;
 case "C":
     // Char
     echo "    <input type=\"text\" class=\"inputbox\"  name=\"product_type_" . $product_type_id . "_" . $dbpt->f("parameter_name") . "\" value=\"" . $dbp->f($dbpt->f("parameter_name")) . "\" size=\"5\" />";
     break;
 case "V":
     // Multiple Values
     echo "    <input type=\"text\" class=\"inputbox\"  name=\"product_type_" . $product_type_id . "_" . $dbpt->f("parameter_name") . "\" value=\"" . $dbp->f($dbpt->f("parameter_name")) . "\" size=\"20\" />";
     // 						$fields=explode(";",$parameter_values);
     // 						echo "<select class=\"inputbox\" name=\"product_type_".$product_type_id."_".$dbpt->f("parameter_name");
     // 						if ($db->f("parameter_multiselect")=="Y") {
     // 							$size = min(count($fields),6);
     // 							echo "[]\" multiple size=\"$size\">\n";
     // 							$selected_value = array();
     // 							$get_item_value = explode(",",$dbp->sf($dbpt->f("parameter_name")));