I'm trying to add to the field list of the categories a new text field called "website_url".
I found many tutorials but none works on magento 1.7.
I created a new module as following :
-code\local\SaponeWebConcept\CategoriesAttributes\sql\categoriesattributes_setup\mysql4-install-0.1.0.php :
<?php
$installer = $this;
$installer->startSetup();
$installer->addAttribute('catalog_category', 'website_url', array(
'type' => 'text',
'backend' => '',
'frontend' => '',
'label' => 'Lien du site',
'input' => 'text',
'class' => '',
'source' => '',
'global' => 0,
'visible' => 1,
'required' => 0,
'user_defined' => 0,
'default' => '',
'searchable' => 0,
'filterable' => 0,
'comparable' => 0,
'visible_on_front' => 0,
'unique' => 0,
'position' => 1,
));
$installer->endSetup();
-code\local\SaponeWebConcept\CategoriesAttributes\etc\config.xml
<?xml version="1.0"?>
<config>
<modules>
<SaponeWebConcept_CategoriesAttributes>
<version>0.1.0</version>
</SaponeWebConcept_CategoriesAttributes>
</modules>
<global>
<resources>
<categoriesattributes_setup>
<setup>
<module>SaponeWebConcept_CategoriesAttributes</module>
<class>Mage_Catalog_Model_Resource_Eav_Mysql4_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</categoriesattributes_setup>
</resources>
</global>
</config>
And my module is correctly activated by this :
<SaponeWebConcept_CategoriesAttributes>
<active>true</active>
<codePool>local</codePool>
</SaponeWebConcept_CategoriesAttributes>
But when I access my category editing, I don't see any new field.
What am I doing wrong ? The module is supposed to work immediatly if the cache is off, right ?
Thanks in advance.
I had the same issue. This is how I solved it:
app/code/local/yourmodulename/sql/yourcustomattribute_setup/mysql4-upgrade-0.0.9-0.1.3.php
<?php
$installer = $this;
$installer->startSetup();
$installer->addAttribute("catalog_category", "your_attribute", array(
"type" => "varchar",
"backend" => "",
"frontend" => true,
"label" => "Your Attribute",
"input" => "text",
"class" => "",
"source" => "",
"global" => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
"visible" => true,
"required" => false,
"user_defined" => false,
"default" => "",
"searchable" => false,
"filterable" => false,
"comparable" => false,
"visible_on_front" => true,
"unique" => true,
"note" => ""
));
$installer->endSetup();
app/code/local/yourmodulename/etc/config.xml
<config>
<modules>
<Yournamespace_Yourmodulename>
<version>0.1.3</version>
</Yournamespace_Yourmodulename>
</modules>
<frontend>
<routers>
<yourmodulename>
<use>standard</use>
<args>
<module>Yournamespace_Yourmodulename</module>
<frontName>categoryattribute</frontName>
</args>
</yourmodulename>
</routers>
<category>
<collection>
<attributes>
<yourmodulename />
</attributes>
</collection>
</category>
<layout>
<updates>
<yourmodulename>
<file>categoryattribute.xml</file>
</yourmodulename>
</updates>
</layout>
</frontend>
<global>
<helpers>
<yourmodulename>
<class>Yournamespace_Yourmodulename_Helper</class>
</yourmodulename>
</helpers>
<blocks>
<yourmodulename>
<class>Yournamespace_Yourmodulename_Block</class>
</yourmodulename>
</blocks>
<models>
<yourmodulename>
<class>Yournamespace_Yourmodulename_Model</class>
<resourceModel>categoryattribute_mysql4</resourceModel>
</yourmodulename>
</models>
<resources>
<yourmodulenamee_setup>
<setup>
<module>Yournamespace_Yourmodulename</module>
<class>Mage_Catalog_Model_Resource_Eav_Mysql4_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</yourmodulename_setup>
<yourmodulename_write>
<connection>
<use>core_write</use>
</connection>
</yourmodulename_write>
<yourmodulename_read>
<connection>
<use>core_read</use>
</connection>
</yourmodulename_read>
</resources>
</global>
</config>
app/etc/modules/Your_modulename.xml
<?xml version="1.0"?>
<config>
<modules>
<Yournamespace_Yourmodulename>
<active>true</active>
<codePool>local</codePool>
<version>0.1.3</version>
</Yournamespace_Yourmodulename>
</modules>
</config>
Check you database to see if the sql has been installed under "Eav Attribute"
You custom category attribute should now be showing in the frontend!!!!
Now all you need to do is show the attribute on the frontened using:
<?php echo $_product->getYourattributeid(); ?>
For those who have this kind of problems my solution in MAGENTO 1.8 whas only make sure that VERSION tag is setted.. if you dont put it cause mysql4-install-0.0.1.php never is called .
<config>
<modules>
<Yournamespace_Yourmodulename>
<active>true</active>
<codePool>local</codePool>
<version>0.0.1</version>
</Yournamespace_Yourmodulename>
</modules>
</config>
Related
I get a problem , look to my code :
...
...
async onRefresh() {
this.setState({ loadingFlatList: true });
Alert.alert(
'Error',
"Refresheeeedd ....",
[
{text: 'OK', onPress: () => null },
],
{cancelable: false}
)
}
<Content refreshControl={<RefreshControl refreshing={this.state.loadingFlatList} onRefresh={this.onRefresh()} />} padder style={{backgroundColor: 'red'}} >
<Loader
loading={this.state.loading} />
<FlatList
data={this.state.listViewData}
// data={[{key: '1'}, {key: '2'}, {key: '3'}, {key: '4'}, {key: '5'}]}
// contentContainerStyle={customers.length === 0 && styles.centerEmptySet}
renderItem={({item}) =>
...
...
When i run the code above. It show alert multiple time (never end) of
the onRefresh function. How to fix it ?
You are calling this.onRefresh when you are defining <RefreshControl componet.
<Content refreshControl={<RefreshControl ... onRefresh={this.onRefresh()} />} ... />
Instead, pass the reference of the function
<Content refreshControl={<RefreshControl ... onRefresh={this.onRefresh} />} ... />
Try with above change, hope this will help!
I have created a file setup/installdata.php:
use Magento\Eav\Setup\EavSetup;
use Magento\Eav\Setup\EavSetupFactory;
use Magento\Framework\Setup\InstallDataInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
class InstallData implements InstallDataInterface
{
private $eavSetupFactory;
public function __construct(EavSetupFactory $eavSetupFactory)
{
$this->eavSetupFactory = $eavSetupFactory;
}
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$eavSetup = $this->eavSetupFactory->create(['setup' => $setup]);
$eavSetup->addAttribute(
\Magento\Catalog\Model\Product::ENTITY,
'name',
[
'type' => 'int',
'backend' => '',
'frontend' => '',
'label' => 'attrlabel',
'input' => 'select',
'class' => '',
'source' => 'a\b\Model\Attribute\Source\m',
'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_GLOBAL,
'visible' => true,
'required' => false,
'user_defined' => true,
'default' => '',
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'used_in_product_listing' => true,
'unique' => false,
'apply_to' => '',
'attribute_set' => 'Default',
]
);
}
}
Then, in etc/module.xml, I have:
<module name="Conlabz_IdentityCheck" setup_version="1.0.0" />
But I still don't see the attribute created.
I also tried the following:
In the Magento root folder, I run the following commands:
php bin/magento module:disable
php bin/magento module:enable
php bin/magento setup:upgrade
php bin/magento cache:flush
All succeed without an error, but as I said, it doesn't work.
What am I doing wrong?
Check your filename setup/installData.php.
"D" should be capital.
Then search table "setup_module" in your magento2 database and delete entry for "Conlabz_IdentityCheck".
Then run following command :
php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f
First, the file and folder name should be Setup/InstallData.php
In your InstallData.php file, you have to add this code at the first line:
namespace Conlabz\IdentityCheck\Setup;
Then just run the CLI commands.
However, if you still facing issues then for reference you can checkout this guide on Magento Attributes.
actually need to pass a parameter which is an xml as an object with xmlrpc node module github.com/baalexander/node-xmlrpc;
client call is :
client.methodCall('anAction', ['aParam'], function (error, value) {})
need to replace aParam with something like that:
<?xml version='1.0'?>
<methodCall>
<methodName>GetBalanceAndDate</methodName>
<params>
<param>
<value><struct>
<member>
<name>originTransactionID</name>
<value><string>90000001</string></value>
</member>
<member>
<name>originHostName</name>
<value><string>PADFVPZ452P01</string></value>
</member>
<member>
<name>subscriberNumber</name>
<value><string>24107482594</string></value>
</member>
<member>
<name>subscriberNumberNAI</name>
<value><int>1</int></value>
</member>
<member>
<name>originTimeStamp</name>
<value><dateTime.iso8601>20140626T14:53:53+0100</dateTime.iso8601></value>
</member>
<member>
<name>originNodeType</name>
<value><string>EXT</string></value>
</member>
</struct></value>
</param>
</params>
</methodCall>
I've tried :
var req1 = {
value: {
struct:{
member:{$name:'originTransactionID',value:'90000001'},
mamber:{$name:'originHostName',value:'GAGAPOPAAPZP01'},
member:{$name:'subscriberNumber',value:'24104151708'},
member:{$name:'subscriberNumberNAI',value: 1},
member:{$name:'originTimeStamp', value: new Date()},
member:{$name:'originNodeType', value: 'EXT'}
}
}
};
client.methodCall('GetBalanceAndDate', [req1], function (error, value) {})
but having error : faultString: 'Illegal request message'
any idea on how it works please??
try to pass xml as a parameter, I do so:
const request = `
<?xml version="1.0"?>
<methodCall>
<methodName>CheckBal</methodName>
<params>
<param>
<value>
<struct>
<member>
<name>RMID</name>
<value><string>${rmid}</string></value>
</member>
<member>
...
</methodCall>`;
client.methodCall('CheckBal', [request], (error, value) => {
console.log(value);
});
I try to use libxmljs with nodejs.
In my sample I want to use the xi:include.
<ord:order xmlns:ord="http://example.org/ord"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://example.org/ord chapter04ord1.xsd"
xmlns:xi="http://www.w3.org/2001/XInclude">
<number>123ABBCC123</number>
<customer>
<name>Priscilla Walmsley</name>
<number>15466</number>
</customer>
<items>
<xi:include href="/Users/mar/ws_e/libxml/test/resources/chapter5prod.xml" />
</items>
</ord:order>
include File:
<ord:product xmlns:ord="http://example.org/ord"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://example.org/ord chapter04ord1.xsd">
<number>557</number>
<name>Short-Sleeved Linen Blouse</name>
<size system="US-DRESS">10</size>
<color value="blue"/>
</ord:product>
This is my code:
var xsdDoc = libxml.parseXml(schemaSource);
var xmlDocValid = libxml.parseXml(docSource);
var xmlDocInvalid = libxml.parseXml(xml_invalid);
xmlDocValid.validate(xsdDoc);
console.dir(xmlDocValid);
console.dir(xmlDocValid.validationErrors);
Then I get the error:
Document {
errors: [],
validationErrors:
[ { Error: Element '{http://www.w3.org/2001/XInclude}include': This element is not expected. Expected is ( product ).
So my question is how to use the x:include right at libxmljs?
Kind regards
Markus
i'm a beginner in bootstrap,i was trying to build an Xpage with the BootstrapValidator to validate an inputText but it dosen't work,below the code source,can we help me to find a solution!
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
xmlns:xc="http://www.ibm.com/xsp/custom">
<xp:this.resources>
<xp:styleSheet href="/bootstrapValidator/css/bootstrap.css"></xp:styleSheet>
<xp:styleSheet href="/bootstrapValidator/css/bootstrapValidator.css"></xp:styleSheet>
<xp:script src="/JQueryXSnippet.js" clientSide="true"></xp:script>
<xp:script src="/bootstrapValidator/js/bootstrap.min.js" clientSide="true"> </xp:script>
<xp:script src="/bootstrapValidator/js/bootstrapValidator.js" clientSide="true"></xp:script>
</xp:this.resources>
<div class="col-md-5">
<xp:inputText id="username" title=" username"></xp:inputText>
</div>
<xp:scriptBlock id="scriptBlock1">
<xp:this.value><![CDATA[$(document).ready(
function() {
$("#{id:username}" ).bootstrapValidator({
message: 'This value is not valid',
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
fields: {
username: {
message: 'The username is not valid',
validators: {
notEmpty: {
message: 'The username is required and can\'t be empty'
},
stringLength: {
min: 6,
max: 30,
message: 'The username must be more than 6 and less than 30 characters long'
},
regexp: {
regexp: /^[a-zA-Z0-9_\.]+$/,
message: 'The username can only consist of alphabetical, number, dot and underscore'
}
}
} } });
]]></xp:this.value>
</xp:scriptBlock>
</xp:view>
Use the XPages compatible jQuery selector x$ instead of the native jQuery $ selector.
Also try using XSP.addOnLoad() instead of (document).ready().
Furthermore, your XPages xp:inputText field called "username" has an id in the browser called something like "view:_id1:_id2:_id8:username". So it's not called "username" as stated in your fields definition for bootstrapValidator. Therefore bootstrapValidator is unable to find the field. Try adding this to your scriptBlock instead of "username: {":
#{id:username}: {