i want to edit and change the admin->catalog->product->edit->option attributes name i.e. price, point and weight to something else. I do it in admin/view/template/product-form.tpl but it does not reflect the change please help.
i change this:
<td class="text-left"><?php echo $entry_subtract; ?></td>
<td class="text-right"><?php echo $entry_price; ?></td>
to this
<td class="text-left"><?php echo "something"; ?></td>
<td class="text-right"><?php echo "something"; ?></td>
In a HTML file with some PHP included
<table>
<tbody>
<tr>
<td>td1</td>
<td>td2</td>
</tr>
<tr>
<td colspan="3">
<?php echo 'something' ?>
</td>
<td>
<?php echo echo 'something' ?>
</td>
<td>
<?php echo 'something' ?>
</td>
</tr>
</tbody>
</table>
I'd like to find all <?php that comes after <td ...> + next line.
(Here not td1 and not td2)
Approach:
(?s)(<td.*?>)+(\n)... also matches <td>td1</td> and <td>td2</td>
What comes after (?s)(<td.*?>)?
To remove the <?php...?> you can replace (<td[^>]*>)\s*<\?php.*?\?> by $1:
Explaining:
(<td[^>]*>) # store in $1 what you want to retrieve
\s* # also match what you want to remove
<\?php.*?\?> # the php content
Then when replacing by $1 it will remove only \s*<\?php.*?\?> which depended on <td>
Hope it helps.
Tryint to experiment the cart library, it is working ok without mx hmvc in in CI3. But as soon as i am inserting MX hmvc files (i.e MY_Loader.php and MY_Router.php in application/core folder and MX folder inside third_party folder) it is throwing error saying
Severity: Notice
Message: Undefined property: Welcome::$Session
Filename: MX/Loader.php
Line Number: 171
I am not even inside the modules just trying to use codeigniter's default controller and view.
My modified codeigniter's controller welcome.php is as below
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Welcome extends CI_Controller {
function __construct()
{
parent::__construct();
}
public function index()
{
$this->load->helper('form');
$this->load->helper('url');
// Load the cart library to use it.
$this->load->library('cart');
// Assuming this is the products from our database
$data['products'] = array(
array(
'id' => 'sku_888',
'qty' => 1,
'price' => 39.95,
'name' => 'T-Shirt',
'options' => array('Size' => 'xxx', 'Color' => 'White')
),
array(
'id' => 'sku_888',
'qty' => 1,
'price' => 39.95,
'name' => 'T-Shirt',
'options' => array('Size' => 'xx', 'Color' => 'green')
),
array(
'id' => 'sku_777',
'qty' => 1,
'price' => 9.95,
'name' => 'Coffee Mug'
),
array(
'id' => 'sku_666',
'qty' => 1,
'price' => 29.95,
'name' => 'Shot Glass'
)
);
// Insert the product to cart
if ($this->input->get('id') != '' && array_key_exists($this->input->get('id'), $data['products']))
{
$this->cart->insert($data['products'][$this->input->get('id')]);
}
// Lets update our cart
if ($this->input->post('update_cart'))
{
unset($_POST['update_cart']);
$contents = $this->input->post();
foreach ($contents as $content)
{
$info = array(
'rowid' => $content['rowid'],
'qty' => $content['qty']
);
$this->cart->update($info);
}
}
$this->load->view('welcome_message', $data);
}
}
and the default codeigniter view welcome_message.php, i modified as below
<b>Products</b>
<table width="100%" border="1">
<tr>
<td width="37%">ID</td>
<td width="30%">Name</td>
<td width="16%">Price</td>
<td width="16%"> </td>
</tr>
<?php $product_array_index = 0;?>
<?php foreach($products as $product):?>
<tr>
<td><?php echo $product['id'];?></td>
<td>
<?php
echo $product['name'] ;
if (array_key_exists('options', $product)) {
echo '<hr>';
foreach ($product['options'] as $key => $value)
{
echo '<strong>' . $key . '</strong> : '. $value . '<br/>';
}
}
?>
</td>
<td><?php echo $product['price'];?></td>
<td>Add to Cart</td>
</tr>
<?php $product_array_index ++;?>
<?php endforeach;?>
</table>
<hr>
<b>Your Cart</b>
<?php echo form_open(base_url()); ?>
<table cellpadding="6" cellspacing="1" style="width:100%" border="1">
<tr>
<th>QTY</th>
<th>Item Description</th>
<th style="text-align:right">Item Price</th>
<th style="text-align:right">Sub-Total</th>
</tr>
<?php $i = 1; ?>
<?php foreach ($this->cart->contents() as $items): ?>
<?php echo form_hidden($i.'[rowid]', $items['rowid']); ?>
<tr>
<td><?php echo form_input(array('name' => $i.'[qty]', 'value' => $items['qty'], 'maxlength' => '3', 'size' => '5')); ?></td>
<td>
<?php echo $items['name']; ?>
<?php if ($this->cart->has_options($items['rowid']) == TRUE): ?>
<p>
<?php foreach ($this->cart->product_options($items['rowid']) as $option_name => $option_value): ?>
<strong><?php echo $option_name; ?>:</strong> <?php echo $option_value; ?><br />
<?php endforeach; ?>
</p>
<?php endif; ?>
</td>
<td style="text-align:right"><?php echo $this->cart->format_number($items['price']); ?></td>
<td style="text-align:right">$<?php echo $this->cart->format_number($items['subtotal']); ?></td>
</tr>
<?php $i++; ?>
<?php endforeach; ?>
<tr>
<td colspan="2"></td>
<td class="right"><strong>Total</strong></td>
<td class="right" align="right">$<?php echo $this->cart->format_number($this->cart->total()); ?></td>
</tr>
</table>
<p><?php echo form_submit('update_cart', 'Update your Cart'); ?></p>
How to make it work?
I want search in my product page for country.To search product by
country. For this i tried to edit the admin panel of virtuemart by
adding country to it.But, its not showing any dropdown.
Added in file- product_edit_information.php
<?php $i = 1 - $i; ?>
<tr class="row<?php echo $i?>">
<td ><div style="text-align:right;font-weight:bold;">
<?php echo JText::_('COM_VIRTUEMART_PRODUCT_COUNTRY') ?></div>
</td>
<td colspan="3">
<select name="mprices[product_currency][0]" id="mpricesproduct_currency0" style="display: none;" class="chzn-done">
<option><?php echo $this->product->product_url; ?></option>
</select>
</td>
</tr>
But, no effect on the admin panel. See the screenshot below:
Also, if possible can anybody suggest a component or module or plugin for coupon system without premium.
I want to display Product Viewed Report in Dashboard itself. Now the report id under Report->Products->Viewed
How to display it? I tried copying the code from admin->controller->report->product_viewed.php TO admin->controller->common->home.php
and copied the code from admin->view->report->product_viewed.tpl to admin->common->home.tpl
i have added code like this in home.tpl
<div class="content">
<table class="list">
<thead>
<tr>
<td class="left"><?php echo $column_name; ?></td>
<td class="left"><?php echo $column_model; ?></td>
<td class="right"><?php echo $column_viewed; ?></td>
<td class="right"><?php echo $column_percent; ?></td>
</tr>
</thead>
<tbody>
<?php if ($products) { ?>
<?php foreach ($products as $product) { ?>
<tr>
<td class="left"><?php echo $product['name']; ?></td>
<td class="left"><?php echo $product['model']; ?></td>
<td class="right"><?php echo $product['viewed']; ?></td>
<td class="right"><?php echo $product['percent']; ?></td>
</tr>
<?php } ?>
<?php } else { ?>
<tr>
<td class="center" colspan="4"><?php echo $text_no_results; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
in my admin panel-> dashboard i am getting error like this
Notice: Undefined variable: products in /Applications/MAMP/htdocs/opencart/admin/view/template/common/home.tpl on line 95Notice: Undefined variable: column_name in /Applications/MAMP/htdocs/opencart/admin/view/template/common/home.tpl on line 88 Notice: Undefined variable: column_model in /Applications/MAMP/htdocs/opencart/admin/view/template/common/home.tpl on line 89 Notice: Undefined variable: column_viewed in /Applications/MAMP/htdocs/opencart/admin/view/template/common/home.tpl on line 90 Notice: Undefined variable: column_percent in /Applications/MAMP/htdocs/opencart/admin/view/template/common/home.tpl on line 91
please help me in solving this? where i should declare this 'products' ?
What it looks like to me is that there are no results from the products viewed and you have done this transition almost perfectly.
You can either update the language files with the appropriate fields in admin>language>english>common>home.php or you can change the tpl a little like this
<div class="content">
<table class="list">
<thead>
<tr>
<td class="left">Product Name:</td>
<td class="left">Model:</td>
<td class="right">Viewed:</td>
<td class="right">Percent:</td>