Gixia VIP
Total posts: 14
21 Oct 2016 13:22

Hello !

I would like to know if its possible to add some informations on this page : ?view=emsale&layout=edit&id=X

I just finished the website for my customer, he sale subscription for food every month, so every month he will have to check who is still subscrib, and how sell the food.

In views/emsale/tmpl/edit.php line 56 there is :

<div class="control-label"><?php echo $this->form->getLabel('user_id'); ?></div>
<div class="controls"><?php echo $this->form->getInput('user_id'); ?></div>

Can i add some customer informations as full name, adresse, zip code, town, and if possible shipping methode ?

With this information it will be easy and fast for the seller to ship all food box every month.

Hope you understood my bad english :D

Thx you

Last Modified: 21 Nov 2016


Sergey
Total posts: 13,748
27 Oct 2016 09:46
  1. In emerald 10, there are aditional field. You can use them to attach any data.
  2. Fo user details, you can use any registration extension that extens registration form and force users to enter aditional information.
  3. Just for address and billing details, you can enable invoicing in Emerald global parameters.

But i understand that none of those reflect your idea. But if you know PHP and stuff there is a way around. If you look DB table you can see params column. you can use that. Add as many fields as you like with name="params[yourname]" and this will be saved in params field as JSON. Later you can grub it, decode and display info in sale detail page for example.

I added this params autosave code next version but you can alter components/com_emerald/api.php youself.

Find line 425

$params = array(
    "properties" => array(
        'currency'     => $plan->params->get('properties.currency', 'USD'),
        'layout_price' => $plan->params->get('properties.layout_price', '00Sign')
    )
);

and replace with

$params = $app->input->get('params', array(), 'array');

$params["properties"] = array(
    'currency'     => $plan->params->get('properties.currency', 'USD'),
    'layout_price' => $plan->params->get('properties.layout_price', '00Sign')
);

These changes are going to be there in next update.


Gixia VIP
Total posts: 14
30 Oct 2016 18:53

Ok thx you, i know a little php code, i will try this.


Gixia VIP
Total posts: 14
15 Nov 2016 11:26

Sry but i tried to call user informations in sale edit page, but my problem is emerald call user by joomla user ID, and hikashop dont use joomla user id

shipping adresse is in the hikashop adress table with hikashop user id in this emerald page, i have just joomla user id

i dont know how to call hikashop user id when i have just joomla user id

i will ask this question to hikashop support too

thx


Gixia VIP
Total posts: 14
16 Nov 2016 10:23

Ok there is a table in database named hikashop_user. In this, we have hikashop user id and joomla user id. I will make a request on this table to take the hikashop user ID and after the hikashop user adress.


Gixia VIP
Total posts: 14
16 Nov 2016 17:09

I have a little problem with my SQL request

In a first time i will catch the joomla Id in a variable with the subscription iD in the url


$id_abo = $_GET['id']; $db = JFactory::getDBO(); $db->setQuery("SELECT user_id FROM # __emerald_subscriptions WHERE id = "$id_abo); $result = $db->loadResult(); echo 'ID user : ' . $result['user_id'];

But when i write line 2 ($result = $db->loadResult();) and refresh the sale page its empty, totaly white page

Was waitting for :

ID user : 152

But nothing

i know a little php and sql but in joomla its different, i dont know where is my error, can you help me plz ?

thx you in advence


pepperstreet VIP
Total posts: 3,837
16 Nov 2016 22:51

Gixia the sale page its empty, totaly white page

Did you enable error reporting in J! global config?

Ok there is a table in database named hikashop_user. In this, we have hikashop user id and joomla user id. I will make a request on this table to take the hikashop user ID and after the hikashop user adress.

Here are some (older) but related forum topics. Maybe something that helps:
- Custom User Plugin - Hikashop Address
- show user id in front end

General info and examples for accessing the J! database:
- Selecting data...


Sergey
Total posts: 13,748
17 Nov 2016 06:54

First waht I can see you miss . here WHERE id = "$id_abo

Gixia the sale page its empty, totaly white page

please google for "Joomla white screed of death" and solve this. then you will se the error and then we will know how to fix it.


Gixia VIP
Total posts: 14
21 Nov 2016 10:49

Hi, its ok i just finished my php code, here my solution for other people who can need it :

<?php 
    $id_abo = JRequest::getInt('id', 0);

    $db = JFactory::getDBO();

        $db->setQuery('SELECT user_id FROM #__emerald_subscriptions WHERE id = ' . $id_abo);
        $emarald_result = $db->loadObject();

        $db->setQuery('SELECT user_id FROM #__hikashop_user WHERE user_cms_id = ' . $emarald_result->user_id);
        $hika_result = $db->loadObject();

        $db->setQuery('SELECT * FROM #__hikashop_address WHERE address_user_id = ' . $hika_result->user_id);
        $hika_adress_result = $db->loadObject();

?>

        <div id="user_adress">
        <h3>Adresse de livraison</h3>
        <p><?php echo $hika_adress_result->address_title . ' ' . $hika_adress_result->address_firstname . ' ' . $hika_adress_result->address_lastname . '<br />' . $hika_adress_result->address_street . '<br />' . $hika_adress_result->address_post_code . ' ' . $hika_adress_result->address_city; ?></p>

        <h3>Tel contact</h3>
        <p><?php echo $hika_adress_result->address_telephone; ?></p>
        </div>

Sergey
Total posts: 13,748
21 Nov 2016 16:05

Cool!

Powered by Cobalt