Post by rexa » Thu Dec 22, 2016 9:49 am

(edit I am using the latest version of OC)

Just want to say that I've been having a blast with modifying opencart (i'm looking to launch a small store as a side hobby). And I've been doing good with making vqmods for certain things so far. Thank you to all the wonderful developers for the hard work you've put in! Anyway...

I've encountered a small stumbling block again which I hope someone can point me in the right direction for. I religiously searched for a day and a half on the forums anything related to this topic, but I could not find an answer, so I apologize if this was answered anywhere else!

I'm going to use the "fax" field in the oc customer database for company name instead. I have my reasons for this as I don't want to use address fields for it. I need to sometimes sort customers by company rather than name in my admin customers lists. Rather than messing with the database by creating a new field for it, I'm just going to substitute the fax field as my workaround which is better for my purpose here.

So... I have a VQmod that can pull up customer ID and show it to me successfully, but the same is not working for the "fax field". I just need friendly guidance again on what other file I should be looking at to be able to populate my "fax" column correctly for customers.

Here is part of the vqmod code related to this:

Code: Select all

 <file name="admin/view/template/customer/customer_list.tpl">
            <operation info="add customer id and company name columns">
                <search position="before"><![CDATA[
                <td class="text-left"><?php if ($sort == 'name') { ?>
                ]]></search>
                <add><![CDATA[
				<td class="text-left">Customer ID</td>
				<td class="text-left">Company</td>
                ]]></add>
            </operation>
			<operation info="populate customer id and company columns">
                <search position="before"><![CDATA[
                <td class="text-left"><?php echo $customer['name']; ?></td>
                ]]></search>
                <add><![CDATA[
				<td class="text-left"><?php echo $customer['customer_id']; ?></td>
				<td class="text-left"><?php echo $customer['fax']; ?></td>
                ]]></add>
            </operation>
		</file>

I guess I was thinking that:

Code: Select all

 <td class="text-left"><?php echo $customer['fax']; ?></td>
was going to automatically populate my fake fax aka company column, but it's not.

So what other file do I need to look at to modify it correctly?

Again, I greatly appreciate any help.

Newbie

Posts

Joined
Mon Dec 05, 2016 9:10 am

Post by OSWorX » Thu Dec 22, 2016 11:06 am

Basically, you are not that wrong.
But .. you have to add the 'fax' field also to the customer array inside the controller (is already fetched in the model).
So add a new line into your xml, like

Code: Select all

,
'fax'			=> $result['fax']
or name it whatever you like.

But, what I really do not understand, why as VQMod??

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Administrator

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by rexa » Thu Dec 22, 2016 12:07 pm

Thank you so much for responding to my thread!

When you say "controller" - which file within the controller folder are you referring to?

I am doing it within a VQmod because I thought it's best to implement it as such rather than modifying core files. If I am wrong with how I am going about this, I'm fully open to suggestions! :)

P.S. I am testing this on a localhost so my "tinkering" will not damage anything as I'm playing around. I have at least three copies of OC to damage :D

Newbie

Posts

Joined
Mon Dec 05, 2016 9:10 am

Post by rexa » Thu Dec 22, 2016 2:16 pm

Now that I did more digging than previously and found this old thread about a previous version:
viewtopic.php?t=65850

It looks like I need to somehow edit or amend:
admin/controller/
admin/view/template

? -or possibly?

I'll have to see how to translate something similar for "fax" within a vqmod for the current OC version unless someone has a better suggestion

Newbie

Posts

Joined
Mon Dec 05, 2016 9:10 am

Post by OSWorX » Thu Dec 22, 2016 5:57 pm

rexa wrote:When you say "controller" - which file within the controller folder are you referring to?
Yes, for sure.
Nearly each action is based on 3 files:
1. controller
2. model
3. view
That is why the architecture of OpenCart is called 'MVC > Model View Controller'
I thought you know that.

And in your case you have too look after customer
rexa wrote: I am doing it within a VQmod because I thought it's best to implement it as such rather than modifying core files. If I am wrong with how I am going about this, I'm fully open to suggestions! :)
Bad idea!
There is NO need to do it with VQMod, OCMod is the 'brother/sister' of VQMod (mainly based on VQMod, but the OC-developer decided to make his own thing ..).
AND, OCMod is already integrated into the core, so no need to install some additonal extension VQMod is.
The syntax is similiar: https://github.com/opencart/opencart/wi ... ion-System
rexa wrote:P.S. I am testing this on a localhost so my "tinkering" will not damage anything as I'm playing around. I have at least three copies of OC to damage :D
Wether with VQmod nor with OCMod you can 'destroy' your installations - that is the great advantage of both.

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Administrator

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria

Post by rexa » Fri Dec 23, 2016 9:09 am

Thank you so much again, OSWorX!

I'm not a coder by trade, and I'm learning and relearning many things here, but you have pointed me in the right direction! This stuff is mostly an enjoyable hobby for me, and I enjoy learning aspects of php coding and structure. I did get it to work, but now that you have given me some wisdom/thoughts about ocmod, I'm rethinking my whole approach.

Cheers!

Newbie

Posts

Joined
Mon Dec 05, 2016 9:10 am

Post by OSWorX » Sat Dec 24, 2016 10:45 pm

Glad to help.
But for more details and/or further help, it would be simplier if you contact me direct (via PM or email).

Full Stack Web Developer :: Dedicated OpenCart Development & Support DACH Region
Contact for Custom Work / Fast Support.


User avatar
Administrator

Posts

Joined
Mon Jan 11, 2010 10:52 pm
Location - Austria
Who is online

Users browsing this forum: No registered users and 2 guests